Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

How do I fix 'object' does not contain a definition for 'Value'?

$
0
0
I have a foreach statement. When I run my code in debug mode, I am getting the following error. I am not sure how to fix it. Google search shows may ways of doing it.

Error:
'object' does not contain a definition for 'Value' and no accessible method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

My code behind
foreach(string caseNumber in userEnteredCaseNumberList)
{
    EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
    newCandidate.CaseNbr = caseNumber;
    newCandidate.RequestorInfoID = requestorItem.Value;//Error here//newCandidate.RequestorInfoID = (ListItem)RequestorDropDownList.SelectedItem.Value;//newCandidate.ReasonID = requestorItem.Value;
    newCandidate.BatchNumber = newBatchNumber;
    newCandidate.EntryStaffUserName = this._loggedInUserName;await CandidateCaseController.PostCandidate(newCandidate);
}

How do I fix System.Net.Mail.SmtException: 'Cannot get IIS pickup directory' error?

$
0
0
I am trying to send email using the EmailButton_Click code. However I am getting the error on this line smtp.Send(mailMessage)

The error is System.Net.Mail.SmtpException: 'Cannot get IIS pickup directory.'

Can someone help me fix it please?

protectedvoid EmailButton_Click(object sender, EventArgs e)
{//get selected email
    EmailButton.Visible = true;string requestor = RequestorDropDownList.SelectedValue.ToString();string message = "The following records have been prepped for processing.  Valid cases will be processed.";if (requestor.Length >0)
         message = string.Format(message);using (MailMessage mailMessage = new MailMessage())
        {
            mailMessage.From = new MailAddress("NoReply_FTA@courts.state.mn.us");//Uncomment after testing in Deve June 2019 
            MailAddress to = new MailAddress(requestor);
            mailMessage.To.Add(to);string ccEmailAddress = "okaymy1112@mail.com";if (ccEmailAddress.Length >0)
            {
                MailAddress ccto = new MailAddress(ccEmailAddress);
                mailMessage.CC.Add(ccto);
            }
                mailMessage.Subject = "FTA Case Reset Notice";
                mailMessage.Body = message;
                SmtpClient smtp = new SmtpClient();
                smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
                smtp.Send(mailMessage);//Error on this line
        }string msg = "No batches were found";
            Response.Write("<script>alert('" + msg + "')</script>");
}

Htmlagilitypack -- I'm stuck

$
0
0
I have been struggling with this problem for some time. What I need to to identify when this is True.
<p
id="noWorkopportunities" class="text-info" style="display:none;">
No available work opportunities found.
/p>
Here is my source and code. Thank You!!

Jim
<div class="panel panel-primary" style="margin-top:10px;">
<div class="panel-heading">
Work Opportunities Available
</div>

<div class="panel-body">
<img id="pw_workopportunities" src="/Images/pleaseWait.gif" alt="Please Wait" style="margin-left:10px" />

<p id="noWorkopportunities" class="text-info" style="display:none;">
No available work opportunities found.
</p>

<table id="workopportunities" style="display:none;" class="table table-bordered">
<tr>
<th>Project Name/Work Order</th>

' Get all tables in the document
Dim tables As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("//table") <b><---- this statements successfully gets all the tables</b>

Dim rows As HtmlAgilityPack.HtmlNodeCollection = main.DocumentNode.SelectNodes("//p[@id='noWorkopportunities'") <b><---I get an error/nothing</b>
' Iterate all rows in the first table
For k = 0 To rows.Count - 1

.Net Core 2.2.4 - Getting IHostingEnvironment in Program.cs Main

$
0
0
I know how to get it in Startup, but I wrote a class that seeds the database with values, and expanded it to write the product images to wwwroot from the database called SeedDatabase. I just need the wwwroot so I can write the images to the right place.

Guess I figured it out...
Amazing, had no idea this would work, well in development at least.
So I can request services from startup? That's my new question.
private static void SeedDatabase(IWebHost host, Settings appSettings, bool isDocker, string env)
{
    using (var scope = host.Services.CreateScope())
    {
        var services = scope.ServiceProvider;
        var logger = services.GetRequiredService<ILogger<Program>>();
        var environment = services.GetService<IHostingEnvironment>();
        logger.LogInformation("DbAuthConnection=" + appSettings.MongoDB.Connection);
        logger.LogInformation("DbAuthContainer=" + appSettings.MongoDB.Container);
        logger.LogInformation("Environment=" + env);

        try
        {
            DbInitializer.SeedData(appSettings, environment, isDocker);<br />
            logger.LogInformation("Seed DB Succeeded:" + DateTime.Now);

        }
        catch (Exception ex)
        {
            logger.LogError(ex, "Seed DB Failed on " + DateTime.Now + ":" + ex.Message);                    
        }
    }
}   
If it ain't broke don't fix it
Discover my world at jkirkerx.com

How to I fix "The method or operation is not implemented"?

$
0
0
When I run my code, when I want to check the user who is logged in (this is a web application), the method called is having an error saying The method or operation is not implemented.

I need help to fix it by implementing the method.

Here is where the error occurs

try
{foreach (string caseNumber in userEnteredCaseNumberList)
	{
		EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
		newCandidate.CaseNbr = caseNumber;
		newCandidate.RequestorInfoID = Convert.ToInt32(requestorItem.Value);
		newCandidate.EntryStaffUserName = Helpers.Authentication.GetADEmail(); //Calls public static string GetADEmmail methodawait CandidateCaseController.PostCandidate(newCandidate);
	}
}catch (Exception ex)//shows The method or operation is not implemented.
{string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "GetCasesButton_Click()", ex.Message);
 ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + errorMsg + "');", true);
}


Method that is called by line 8 with EntryStaffUserName. The error on on this method on line 7

publicstaticstring GetADEmail()
{string retVal = string.Empty;using (var context = new PrincipalContext(ContextType, "COURTS"))
        {
	         UserPrincipal user = new UserPrincipal(context);
                user = UserPrincipal.FindByIdentity(context, IdentityType, Environment.UserName);//this is where there is an issue. I can see UserName has a value
                retVal = user.EmailAddress;
        }return retVal;
}

Dynamically updating the site with progress bar

$
0
0
I tried finding the solution or lead on how to implement dynamically updating the site with progress bar but on failing I am posting here.

My problem is that, I am fetching data from 4 different sources by hitting them in realtime and every source return data in blocks of results i.e. first 10 then, then again after querying by telling I have pulled previous then it again provide more. I want to show sorted data as and when I am able to fetch (I am able to fetch successfully) i.e. if I am able to receive data from first two sites I need to show them with sort on Alphabet then if again received more from those sites or other one again I should sort till all the results are fetched.

Displaying two images but code is for single image

$
0
0
Why this code shows two images instead of one

 protected void Page_Load(object sender, EventArgs e)
    {
        //<div id="vlightbox1">
//        var ahrefcontrol = new HtmlGenericControl("a class="+"\vlightbox1\"" +" " +"href="+ "\"index_files/vlb_images1/img20200127wa0004.jpg\"" + "/");
        string divs = "<div class=" + "\"vlightbox1\">";
        string divend = "</div>";
        string anch = divs + "<a class=" + "\"vlightbox1\" " + "href=" + "\"index_files/vlb_images1/img20200127wa0004.jpg\"" + " " + ">"
            + "<img src=" + "\"index_files/vlb_thumbnails1/img20200127wa0004.jpg\"/" + "></a>" + divend;

        
        string fnl =  anch;
        var imgcontrol2 = new HtmlGenericControl(fnl);
        this.Page.Form.FindControl("ContentPlaceHolder2").Controls.Add(imgcontrol2);
       
    }

Procedure or function 'bla' expects parameter '@OrderNumber', which was not supplied.

$
0
0
Hi,

Breaking my head, over this error, for which the reason according to all google results I have been able to find, is usually a simple omission of SelectCommandType="StoredProcedure", or some simple typo.

If this is the case for me, I am just not seeing it.
<asp:ListViewID="ListViewOrderRow"runat="server"DataKeyNames="rowguid"DataSourceID="SqlDataSource1"OnDataBound="ListViewOrderRow_DataBound"><asp:LabelID="afp_nrLabel"runat="server"Text='<%# Eval("afp_nr") %>'></asp:Label><asp:LabelID="auf_trnrLabel"runat="server"Text='and lots more stuff like this'></asp:Label></asp:ListView><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:ConnectionStringFDS %>"ProviderName="<%$ ConnectionStrings:ConnectionStringFDS.ProviderName %>"SelectCommand="sp_Warehouse_RowsByOrderNumberAndWarehouse"SelectCommandType="StoredProcedure"><SelectParameters><asp:QueryStringParameterDirection="Input"DefaultValue="x"Name="@OrderNumber"QueryStringField="afp_nr"Type="String"/><asp:QueryStringParameterDirection="Input"DefaultValue="x"Name="@Warehouse"QueryStringField="wh_nr"Type="String"/></SelectParameters></asp:SqlDataSource>

The address shows that the necessary parameter values are being passed to the page:
"http://address/folder/OrderPicking.aspx?afp_nr=1586474&wh_nr=02"

Any and all help much appreciated.

Regards,
Johan
My advice is free, and you may get what you paid for.

Files download fails for ipad and iphone clients

$
0
0
I have a web application based in aspnet 4.5 that is running on a Windows 2016 Server with IIS 10. The app allows to client the downloading of several documents (img, pdf, zip files). All works correctly from several years but starting from 4 weeks to now ios based client (ipad and iphone running 13.3 ios) receive corrupted files. Looking at the logs I have seen that the client closes the connection abnormaly.
this is the code snippets i use to send files:
   Response.Clear();
                System.IO.FileInfo fInfo = new System.IO.FileInfo(allegatizipfilename);
                Response.AddHeader("Content-Length", fInfo.Length.ToString());
                Response.AddHeader("Content-disposition", "attachment; filename=allegati.zip");
                Response.ContentType = "application/octet-stream";
                Response.TransmitFile(allegatizipfilename);
                Response.Flush(); 
Response.End();


I have tried to disable http2, to allow longer connection time, to reduce the minimal connection speed all with no results.

What is strange to me is the fact that anything worked fine till some week ago and nothing was changed in the server configuration nor the software code.

Anyone has the same issue ?

Dropdown Filtering in grideview vb.net

$
0
0
I am trying to apply filters from one dropdown in a datagrid to another dropdown in the same datagrid and same row. The "edit" screen shot is the most important.

The dropdown under "Chamber" will be used to filter the values in the "District" dropdown. Basically, the "Districts" are tied to a "Chamber". I am having a lot of trouble because of the EditItemTemplate sections.

Thank you for the help in advance!

<!--Term Start--><asp:GridViewCssClass="datatable"ShowFooter="false"ShowHeaderWhenEmpty="true"DataKeyNames="ProfileTermID"DataSourceID="ldsTerms"ID="gvTerms"OnDataBound= "OnDataBound"OnRowCommand="gvTerms_RowCommand"runat="server"AutoGenerateColumns="False"><HeaderStyleBackColor="#999999"ForeColor="#ffffff"/><RowStyleCssClass="divRow"/><EditRowStyleBackColor="#b3d4e8"Height="50px"VerticalAlign="Middle"HorizontalAlign="Center"/><FooterStyleBackColor="#b3d4e8"Height="50px"VerticalAlign="Middle"HorizontalAlign="Center"/><EmptyDataTemplate>
                                       Legislator Has No Terms</EmptyDataTemplate><Columns><asp:BoundFieldDataField="ProfileID"HeaderText="ProfileID"/><asp:TemplateFieldHeaderText="Term Start Date"ItemStyle-CssClass="divCell"><EditItemTemplate><telerik:RadDatePickerID="rdtTermStart"Skin="Metro"runat="server"SelectedDate='<%#Eval("TermStartDate")%>'></telerik:RadDatePicker></EditItemTemplate><ItemTemplate><%#Eval("TermStartDate", "{0:d}")%></ItemTemplate><FooterTemplate><telerik:RadDatePickerID="rdtTermStartF"Skin="Metro"runat="server"></telerik:RadDatePicker></FooterTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="TermEndDate"ItemStyle-CssClass="divCell"><EditItemTemplate><telerik:RadDatePickerID="rdtTermEnd"Skin="Metro"runat="server"Width="200px"SelectedDate='<%# IIf(IsDBNull(Eval("TermEndDate")), vbNull, Eval("TermEndDate"))    %>'/></EditItemTemplate><ItemTemplate><%# IIf(IsDBNull(Eval("TermEndDate")), vbNull, Eval("TermEndDate", "{0:d}"))    %></ItemTemplate><FooterTemplate><telerik:RadDatePickerID="rdtTermEndF"Skin="Metro"runat="server"></telerik:RadDatePicker></FooterTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="Chamber"ItemStyle-CssClass="divCell"><EditItemTemplate><asp:DropDownListID="ddChamber"DataSourceID="ldsChambers"DataTextField="Name"DataValueField="ID"runat="server"AutoPostBack="true"OnSelectedIndexChanged="ddChamber_SelectedIndexChanged"SelectedValue='<%# Bind("ChamberID") %>'></asp:DropDownList></EditItemTemplate><ItemTemplate><%#Eval("mod_chamber.Name")%></ItemTemplate><FooterTemplate><asp:DropDownListID="ddChamberF"AutoPostBack="true"OnSelectedIndexChanged="ddChamberF_SelectedIndexChanged"DataSourceID="ldsChambers"DataTextField="Name"DataValueField="ID"runat="server"></asp:DropDownList></FooterTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="Party"ItemStyle-CssClass="divCell"><EditItemTemplate><asp:DropDownListID="ddParty"DataSourceID="ldsParties"DataTextField="Name"DataValueField="ID"runat="server"SelectedValue='<%# Bind("PartyID") %>'></asp:DropDownList></EditItemTemplate><ItemTemplate><%#Eval("mod_party.name")%></ItemTemplate><FooterTemplate><asp:DropDownListID="ddPartyF"DataSourceID="ldsParties"DataTextField="Name"DataValueField="ID"runat="server"></asp:DropDownList></FooterTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="District"ItemStyle-CssClass="divCell"><EditItemTemplate><asp:DropDownListID="ddDistrict"DataSourceID="ldsDistricts"DataTextField="Name"DataValueField="ID"runat="server"></asp:DropDownList></EditItemTemplate><ItemTemplate><%#Eval("mod_district.name")%></ItemTemplate><FooterTemplate><asp:DropDownListID="ddDistrictF"DataTextField="Name"DataValueField="ID"runat="server"></asp:DropDownList></FooterTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="County"ItemStyle-CssClass="divCell"><EditItemTemplate><asp:DropDownListID="ddCounty"DataSourceID="ldsCounty"DataTextField="Name"DataValueField="ID"runat="server"SelectedValue='<%# Bind("CountyID") %>'></asp:DropDownList></EditItemTemplate><ItemTemplate><%#Eval("mod_county.name")%></ItemTemplate><FooterTemplate><asp:DropDownListID="ddCountyF"DataSourceID="ldsCounty"DataTextField="Name"DataValueField="ID"runat="server"></asp:DropDownList></FooterTemplate></asp:TemplateField><asp:TemplateFieldHeaderText=""ShowHeader="False"ItemStyle-CssClass="divCell"ItemStyle-Height="34px"><EditItemTemplate><asp:ImageButtonID="ImageButton6"runat="server"CausesValidation="False"CommandName="Update"Text="Update"ToolTip="Update"ImageUrl="/admin/images/success.png"/></EditItemTemplate><FooterTemplate><asp:ImageButtonID="ImageButton3"runat="server"CausesValidation="False"CommandName="Insert"ToolTip="Insert"Text="Insert"ImageUrl="/admin/images/success.png"/></FooterTemplate><ItemTemplate><asp:ImageButtonID="ImageButton1"runat="server"CausesValidation="False"CommandName="Edit"Text="Edit"ImageUrl="/admin/images/ico_edit_a.png"/></ItemTemplate></asp:TemplateField><asp:TemplateFieldHeaderText=""ShowHeader="False"ItemStyle-CssClass="divCell"ItemStyle-Height="34px"><ItemTemplate><asp:ImageButtonID="ImageButton2"runat="server"CausesValidation="False"CommandName="Delete"Text="Delete"ImageUrl="/admin/images/ico_delete_a.png"/></ItemTemplate><EditItemTemplate><asp:ImageButtonID="ImageButton3"runat="server"CausesValidation="False"CommandName="Cancel"Text="Cancel"ImageUrl="/admin/images/ico_subtract.png"/></EditItemTemplate><FooterTemplate><asp:ImageButtonID="ImageButton7"runat="server"CausesValidation="False"CommandName="Cancel_New"Text="Cancel"ImageUrl="/admin/images/ico_subtract.png"/></FooterTemplate></asp:TemplateField></Columns></asp:GridView></div></div><asp:LinqDataSourceID="LinqDataSource1"runat="server"ContextTypeName="CMSmodules.modulesDataContext"TableName="mod_Profiles"EnableDelete="True"></asp:LinqDataSource><asp:LinqDataSourceID="LinqDataSource2"runat="server"ContextTypeName="CMSmodules.modulesDataContext"EnableInsert="True"EnableUpdate="True"TableName="mod_Profiles"Where="ID == @ID"><WhereParameters><asp:ControlParameterControlID="lvContent"DefaultValue="0"Name="ID"PropertyName="SelectedValue"Type="Int32"/></WhereParameters></asp:LinqDataSource><asp:LinqDataSourceID="ldsTerms"runat="server"ContextTypeName="CMSmodules.ModulesDataContext"EntityTypeName=""TableName="mod_ProfileTerms"EnableDelete="True"EnableInsert="True"EnableUpdate="True"></asp:LinqDataSource><asp:LinqDataSourceID="ldsDistricts"runat="server"ContextTypeName="CMSmodules.modulesDataContext"TableName="mod_Districts"OrderBy="Name"Select="new (ID, Name)"></asp:LinqDataSource><asp:LinqDataSourceID="ldsParties"runat="server"ContextTypeName="CMSmodules.modulesDataContext"TableName="mod_Parties"OrderBy="Name"Select="new (ID, Name)"></asp:LinqDataSource><asp:LinqDataSourceID="ldsChambers"runat="server"ContextTypeName="CMSmodules.modulesDataContext"TableName="mod_Chambers"OrderBy="Name"Select="new (ID, Name)"></asp:LinqDataSource><asp:LinqDataSourceID="ldsCounty"runat="server"ContextTypeName="CMSmodules.modulesDataContext"TableName="mod_Counties"OrderBy="Name"Select="new (ID, Name)"></asp:LinqDataSource><asp:LinqDataSourceID="ldsSessions"runat="server"ContextTypeName="CMSmodules.modulesDataContext"TableName="mod_Sessions"OrderBy="Name"Select="new (ID, Name)"></asp:LinqDataSource>

Writing a client app for OData

$
0
0
Hi, I am new to the OData World - I am researching, I have been given a task to connect to OData Services they have, they are exposing their Data through OData - that's what I understood, based upon that I have to write an ASP.Net client application, they have given URLs to connect to their OData Services, now I want to understand couple of things before I start writing my client app.

1. What's the use of exposing Data as OData over other web/rest services, why do we need it? Are there any security advantages?
2. What are the best ways to connect to OData Service from client like Entity Framework is better or just use .Net C#?
3. What precautions should I take when I am connecting and using a OData Service?
4. Any other suggestions you can give me would be very very appreciated - thanks a lot. I am also researching about it, but if you know something already also would be helpful - thanks again.

(SOLVED) Any ideas why gridview is not getting populated with data from the database?

$
0
0
Hello experts,

We have an app that prompts employees to enter his/her empID.

Once the employee enters his/her ID, the VB/Stored Proc checks the ID to determine if user has entered his/her information from previous year.

If no, the user gets a blank page to enter his/her data.

If user had entered data the previous year, our objective is to have data populate the GridView control giving the user the opportunity to review data and make changes if necessary.

The code largely works when populating data outside of GridView.

However, GridView is not getting populated with the two sourcename and spousename.

Obviously, it is not recognizing textboxes from GridView.

Any ideas how to resolve this?

My abbreviated code below. Thanks a lot in advnce

Sorry for the long code.

Stored Proc
ALTER PROCEDURE [dbo].[ValidateEmpID]
@empID varchar(50)
AS
BEGIN
SET NOCOUNT OFF;
SELECT employeeName, email, emptitle, EmpID,
    CASE WHEN YEAR(d.dateCreated) = YEAR(getdate()) -1 THEN 1 ELSE 0 END as previousYear, 
    CASE WHEN YEAR(d.dateCreated) = YEAR(getdate()) THEN 1 ELSE 0 END as thisYear 
    FROM Employees e 
    INNER JOIN dateDetails d on e.employeeID = d.EmployeeID 
    INNER JOIN SourceDetails so on e.employeeID = so.EmployeeID
	INNER JOIN SpouseDetails sp on e.employeeID = sp.employeeID 
    WHERE EmpID=@empID
 END

//HTML

  <div class="table-responsive"><table class="table"><tr><td><div class="form-group"><label for="lblEname"><span style="font-weight:bold;font-size:16px;color:#000000;">Employee Name</span><span style="color:#ff0000">*</span></label><asp:TextBox ID="txteName" placeholder="Employee name..." style="width:200px;" class="form-control" runat="server"></asp:TextBox><asp:RequiredFieldValidator id="RequiredFieldValidator2" Font-Bold="true" 
	 SetFocusOnError="true" runat="server" 
	 ErrorMessage="*" ControlToValidate="txteName" /><br /></div></td><td><div class="form-group"><label id="lblTitle"><span style="font-weight:bold;font-size:16px;color:#000000;">Your title</span><span style="color:#ff0000">*</span></label><asp:TextBox ID="txttitle" placeholder="Employee title..." style="width:200px;" class="form-control" runat="server"></asp:TextBox><asp:RequiredFieldValidator id="RequiredFieldValidator3" Font-Bold="true" 
	   SetFocusOnError="true" runat="server" 
	 ErrorMessage="*" ControlToValidate="txttitle" /></div> </td><td><div class="form-group"><label id="lblEmail"><span style="font-weight:bold;font-size:16px;color:#000000;">Your email address</span><span style="color:#ff0000">*</span></label><asp:TextBox ID="txtemail" placeholder="Employee email..." style="width:200px;" class="form-control" runat="server"></asp:TextBox><asp:RequiredFieldValidator id="RequiredFieldValidator4" Font-Bold="true" 
	SetFocusOnError="true" runat="server" 
	ErrorMessage="*" ControlToValidate="txtemail" /></div></td></tr></table></div><table class="table"><tr><td><asp:gridview ID="Gridview1" RowStyle-Wrap="false" gridlines="None" CssClass="responsiveTable1" runat="server" ShowFooter="true" AutoGenerateColumns="false" onrowdatabound="Gridview1_RowDataBound" OnRowDeleting="Gridview1_RowDeleting"><Columns><asp:BoundField DataField="RowNumber" Visible="false" HeaderText="Row Number" /><asp:TemplateField HeaderText="Name"><headerstyle horizontalalign="Left" /><ItemTemplate><asp:TextBox ID="txtsourcename" Text='<%# Eval("sourcename") %>' placeholder="Name...(e.g, Jane Doe)" runat="server" style="width:375px;" AutoPostBack="true" class="form-control textClass" OnTextChanged="txtsourcename_TextChanged"></asp:TextBox><br /><asp:CheckBox ID="grid1Details" ClientIDMode="Static" runat="server" Checked="false" AutoPostBack="true" OnCheckedChanged="Grid1CheckChanged" /><span style="color:#ff0000">*Check this box if N/A</span></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Address"><ItemStyle HorizontalAlign="Left"></ItemStyle><ItemTemplate><asp:TextBox ID="txtsourceaddress" Text='<%# Eval("sourceaddress") %>' placeholder="Address..." runat="server" style="width:375px;" class="form-control textClass"></asp:TextBox><br /><br /></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText=""><ItemTemplate><asp:Button ID="ButtonAdd" runat="server" Text="Add another row if needed" 
		onclick="ButtonAdd_Click" CssClass="grvAddButton" /><br /><br /><br></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText=""><ItemTemplate><asp:Button ID="sourceDelete" runat="server" Text="Delete" CommandName="Delete"
		 CssClass="grvDelButton" OnClientClick="return confirm('Are you sure you want to remove this row?')"  /> <br /><br /><br /></ItemTemplate></asp:TemplateField> </Columns></asp:gridview></td></tr></table>
//VB
Protected Sub txtEmpID_TextChanged(sender As Object, e As EventArgs) Handles txtEmpID.TextChanged
  If Not String.IsNullOrEmpty(txtEmpID.Text) Then
      Dim Conn As SqlConnection
      'Read in connection String
      Conn = New SqlConnection(ConfigurationManager.ConnectionStrings("constr").ConnectionString)
      Conn.Open()
      Dim cmd As New SqlCommand("ValidateEmpID", Conn)
      cmd.CommandType = CommandType.StoredProcedure
      cmd.Parameters.AddWithValue("@empID", txtEmpID.Text)
      Dim dr As SqlDataReader = cmd.ExecuteReader()
      If dr.HasRows Then
	  'Employee exists'
	  dr.Read()
	  checkusername.Visible = True
	  dprocessed.Visible = True
	  If dr("previousYear").ToString() = "1" Then
	      imgstatus.ImageUrl = "images/NotAvailable.jpg"
	      lblStatus.Text = "Please verify your information for accuracy. Then complete rest of the form."
	      lblStatus.ForeColor = System.Drawing.Color.Red
	      System.Threading.Thread.Sleep(300)
	      txteName.Text = dr("employeeName").ToString()
	      txttitle.Text = dr("empTitle").ToString()
	      txtemail.Text = dr("email").ToString()
	      txtEmpID.Text = dr("empID").ToString()

	      Dim currentRow As GridViewRow = CType((CType(sender, TextBox)).Parent.Parent.Parent.Parent, GridViewRow)
	      Dim txtsource As TextBox = CType(currentRow.FindControl("txtsourcename"), TextBox)
	      txtsource.Text = dr("sourcename").ToString()
	      Dim txtsource As TextBox = CType(currentRow.FindControl("txtspousename"), TextBox)
	      txtspouse.Text = dr("spousename").ToString()                      

	  ElseIf dr("thisYear").ToString() = "1" Then
	      imgstatus.ImageUrl = "images/NotAvailable.jpg"
	      lblStatus.Text = "You have already completed this Disclosure form. Please close the form. If you feel there is a mistake, please contact Clerk at xxx-xxx-xxxx"
	      lblStatus.ForeColor = System.Drawing.Color.Red
	      System.Threading.Thread.Sleep(300)
	      txteName.Text = dr("employeeName").ToString()
	      txttitle.Text = dr("empTitle").ToString()
	      txtemail.Text = dr("email").ToString()
	      txtEmpID.Text = dr("empID").ToString()
	      txteName.Enabled = False
	      txttitle.Enabled = False
	      txtemail.Enabled = False
	      txtEmpID.Enabled = False
	      GridPanels.Enabled = False
	      dprocessed.Visible = True
	      btnNext.Enabled = False
	  Else
	      'not this year, nor the previous year'
	  End If
      Else
	  checkusername.Visible = True
	  dprocessed.Visible = True
	  imgstatus.ImageUrl = "images/Icon_Available.gif"
	  lblStatus.Text = "Proceed to complete entire form"
	  lblStatus.ForeColor = System.Drawing.Color.Red
	  System.Threading.Thread.Sleep(300)
	  txteName.Text = ""
	  txttitle.Text = ""
	  txtemail.Text = ""
      End If
  Else
      checkusername.Visible = False
  End If
End Sub

HTTP Error 500.19 - Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid

$
0
0
Hi I am getting the following error when I changed the path of the application - from source control, source control took the latest version of the application but started giving me the following error - any help please? This is the error messages that I am getting

Detailed Error Information:
Module	   WindowsAuthenticationModule
Notification	   AuthenticateRequest
Handler	   ExtensionlessUrlHandler-Integrated-4.0
Error Code	   0x80070021
Config Error	   This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
Config File	   \\?\C:\SrcCode\IMS\Development\IMS\IMS.Web\web.config


Config Source:
   99:         <anonymousAuthentication enabled="true" />
  100:         <windowsAuthentication enabled="true" />
  101:       </authentication>

More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.
View more information »


Any help please - its urgent - thanks in advance please

How do I solve error StatusCode: 500?

$
0
0
I am getting an error when I try to get case information from a database (Justice)

Here is the error:
{StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{Pragma: no-cache Cache-Control: no-cache Date: Wed, 29 Jan 2020 22:07:12 GMT Server: Microsoft-IIS/8.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 6066 Content-Type: application/json; charset=utf-8 Expires: -1 }}


I need help to solve the error StatusCode: 500 When button is clicked JusticeContoller class is called. This is where I am getting an error on line response=await client.GetAsync("api/GetAllAcceptCAseNumbers/" + candidateCases);

protectedasyncvoid GetCasesButton_Click(object sender, EventArgs e)
{//#region Required Field Validationif (CaseNumbersTextBox.Text.Length <1)
    {string myStringVariable = "Case number textbox cannot be empty.";
        ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);return;
    }try
        {#region Get Batch Numberint newBatchNumber = await CandidateCaseController.GetNextBatchNumber();#endregion#region Insert entered case numbers in databaseforeach (string caseNumber in userEnteredCaseNumberList)
            {
                EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
                newCandidate.CaseNbr = caseNumber;
                newCandidate.EntryStaffUserName = Helpers.Authentication.GetADEmail();await CandidateCaseController.PostCandidate(newCandidate);
            }#region Get MNCIS info on cases//candidateCasesString
            List<string> smallEnoughStrings = new List<string>();
            List<AcceptCaseNumbersModel> mncisDetailList = new List<AcceptCaseNumbersModel>();
            List<AcceptCaseNumbersModel> smallEnoughMncisDetailList = new List<AcceptCaseNumbersModel>();foreach (string smallEnoughString in smallEnoughStrings)
            {
                smallEnoughMncisDetailList = await FTACaseReseting.Controllers.JusticeController.GetAllAcceptCaseNumbers(smallEnoughString);
                mncisDetailList.AddRange(smallEnoughMncisDetailList);
            }#endregion
        }catch (Exception ex)
        {string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "GetCasesButton_Click()", ex.Message);
            ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + errorMsg + "');", true);
        }
}


Here is the class called when button click even happens
publicclass JusticeController
{#region Getpublicstaticasync Task<List<AcceptCaseNumbersModel>> GetAllAcceptCaseNumbers(string candidateCases)
    {
        List<AcceptCaseNumbersModel> retVal = new List<AcceptCaseNumbersModel>();

        TokenModel tm = new TokenModel();
        tm = await TokenController.GetAccessToken();if (tm.access_token.Length >0)
        {using (HttpClient client = DataAccess.EstablishConnection(ConfigurationManager.AppSettings.Get("ServiceUri"), ConfigurationManager.AppSettings.Get("ServiceReturnType")))
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tm.access_token);

                HttpResponseMessage response = new HttpResponseMessage();
                response = await client.GetAsync("api/GetAllAcceptCaseNumbers/" + candidateCases);if (response.IsSuccessStatusCode)
                    retVal = await response.Content.ReadAsAsync<List<AcceptCaseNumbersModel>>();
            }
        }return retVal;
    }#endregion}

SQL and IIS error when publish an ASP .NET application to IIS

$
0
0
I have added a database to my application and then published it in IIS. I am getting an SQL error and IIS error when trying to browse to the site and have been trying to figure it out all day. I hope you can look and see if you can come up with something. The IIS error is: "Cannot open database "KML" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM'". The SQL error is: "[SqlException (0x80131904): Cannot open database 'KML' requested by the login. The login failed. Login failed for user 'NT_AUTHORITY\SYSTEM'. ] . I hope someone can figure out what the problem is. Thanks.

IIS changing the IE11 document mode from 11 (Default) to 7 (Default) when browsing to a site

$
0
0
I have an ASP .NET application that requires Document Mode to default to IE11. I have set the computer local IE11 browser to default to document mode IE11. The problem I have is when I deploy my ASP .NET site to IIS and browse to the site the Document Mode gets changes back to IE7 Default. Because of this my JavaScript does not work. How do I set the IE11 Document mode to IE11 default when I browse to the site and not change it back to IE7 default?

.net core Swagger code gen

$
0
0
Has anyone used Swagger codegen and done customisation on auto generated .net project files
Manoj

In need of direction for project

$
0
0
Hello: We're hoping somebody here can help point us in the right direction for a web based project we're working on.

Based on user-input, we need to generate a diagram using real world units and render the output to the browser. e.g. the user enters width and height in inches, and we create a rectangle with these units. We've been trying to use SVG, but we're having trouble getting it to scale appropriately.
Appreciate any input you have to offer.

Thanks.

How do I solve InvalidCaseUserControl.Dispose(bool) no suitable method found to override

$
0
0
I am creating a usercontrol named InvalidCaseUserControl in web forms for a web app. When I run the code in debug mode I am getting the following errors CS0079 The event 'Control.Disposed' can only appear on the left hand side of += or -=
Error CS7036 There is no argument given that corresponds to the required formal parameter 'e' of 'EventHandler'
Error CS0115 'InvalidCaseUserControl.Dispose(bool)': no suitable method found to override

How do I solve this?

publicpartialclass InvalidCaseUserControl : System.Web.UI.UserControl
{privateint _batchNumber;private System.ComponentModel.IContainer components = null;///<summary>/// Clean up any resources being used.///</summary>///<paramname="disposing">true if managed resources should be disposed; otherwise, false.</param>protectedoverridevoid Dispose(bool disposing)//Getting 'InvalidCaseUserControl.Dispose(bool)':no suitable method found to override
    {if (disposing && (components != null))
        {
            components.Dispose();
        }base.Disposed(disposing);
    }
}

How to set starting page or controller method of a web application when we are deploying the React or Angular or Ember applications

$
0
0
Hi -
I know its dumbest question but I want to understand.

I have completed a React Application, which calls a Web Api, the application runs fine with npm start, its all working fine, but when I am deploying the application, how should I set up the start page of the application, I am new to React and I have never been part of the deploying any SPA application? How can I set the start of my react application when I am going to deploy on the Server in my Website folder? Can I change it? How can I change it?

When Web API is deployed separately from the React app, where would the new request first goes, whether it would go to the React SPA or it goes to the Web APIs controller method.

Same questions I have for Vue.js, Angular and Ember, what are the starting pages, how to set them and if we have separate web applications running for the js and Web Api server side logic - where do the request first go when we just type for example: xxxx.com, what's the first page.

I got this question since when I build my Ember project using npm build - its not creating the default.htm or index.html files - so how is it going to the first page? Any help to understand the flow here. I know its dumbest question but want to understand - thank you.
Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>