|
You're only calling the fillSourceRecords method if the first row returned from the ValidateEmpID procedure was created last year.
I suspect you might have the previousYear / currentYear test the wrong way round - it doesn't make sense to me that you'd be able to edit last year's records, but not this year's records. But I don't know your requirements, so perhaps that's correct?
It looks like your ValidateEmpID procedure could return multiple rows, but you're only processing one row here. Again, that seems odd to me.
It looks like you want to clear the controls in all cases where the procedure doesn't return a row for either this year or the previous year. I'd be inclined to do that before executing the query; otherwise, you'll need to repeat the code in every Else block.
You'll probably want to remove the Thread.Sleep calls too, unless you're looking for an easy way to speed up the code in a future update.
I think something like this would possibly be easier to follow (assuming I've not missed something):
Protected Sub txtEmpID_TextChanged(sender As Object, e As EventArgs) Handles txtEmpID.TextChanged
If String.IsNullOrEmpty(txtEmpID.Text) Then
checkusername.Visible = False
Return
End If
txteName.Text = String.Empty
txttitle.Text = String.Empty
txtemail.Text = String.Empty
lblStatus.Text = String.Empty
Gridview1.DataSource = Nothing
Gridview1.DataBind()
checkusername.Visible = True
dprocessed.Visible = True
lblStatus.ForeColor = System.Drawing.Color.Red
Using Conn As New SqlConnection(ConfigurationManager.ConnectionStrings("constr").ConnectionString)
Using cmd As New SqlCommand("ValidateEmpID", Conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@empID", txtEmpID.Text)
Conn.Open()
Using dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If Not dr.Read() Then
imgstatus.ImageUrl = "images/Icon_Available.gif"
lblStatus.Text = "Proceed to complete entire form"
txteName.Enabled = True
txttitle.Enabled = True
txtemail.Enabled = True
txtEmpID.Enabled = True
GridPanels.Enabled = True
btnNext.Enabled = True
Return
End If
imgstatus.ImageUrl = "images/NotAvailable.jpg"
txteName.Text = dr("employeeName").ToString()
txttitle.Text = dr("empTitle").ToString()
txtemail.Text = dr("email").ToString()
txtEmpID.Text = dr("empID").ToString()
If dr("previousYear").ToString() = "1" Then
lblStatus.Text = "Please verify your information for accuracy. Then complete rest of the form."
txteName.Enabled = True
txttitle.Enabled = True
txtemail.Enabled = True
txtEmpID.Enabled = True
GridPanels.Enabled = True
btnNext.Enabled = True
fillSourceRecords()
Else If dr("thisYear").ToString() = "1" Then
lblStatus.Text = "You have already completed this Disclosure form. Please close the form. If you feel there is a mistake, please contact Clerk to the CEO and BOC at 404-371-3224"
txteName.Enabled = False
txttitle.Enabled = False
txtemail.Enabled = False
txtEmpID.Enabled = False
GridPanels.Enabled = False
btnNext.Enabled = False
Else
txteName.Enabled = False
txttitle.Enabled = False
txtemail.Enabled = False
txtEmpID.Enabled = False
GridPanels.Enabled = False
btnNext.Enabled = False
End If
End Using
End Using
End Using
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
modified 30-Jan-20 13:09pm.
|
|
|
|
|
Thank you so much sir.
You are so very generous.
Just one clarification sir.
The requirement that I was given is that every year, employees will need to complete this form.
If this is the first time, they are completing it, then obviously nothing to edit.
The grid is blank so they can enter their information.
If however, they had completed this form the previous year, then they don't need to complete the form all over again.
The information they had already entered the previous year should load the gridview and they would either keep them if nothing changed from previous year or edit the contents to make them current for the current year.
I hope this explains why only the previous year (not the years past or current year) needs to be loaded so they can edit them if necessary.
I am about to test your solution now sir.
Many, many thanks for your kindness.
|
|
|
|
|
I have a little problem sir.
Normally, when empID is validated, it gives the employee a message either that his/her needs to verify his/her information for accuracy. Then complete rest of the form. This means the employee had completed the form the previous year and his/her information is populated into the gridview.
If the user just completed the form this year, s/he gets a message that s/he has already completed this Disclosure form. Please close the form. If you feel there is a mistake, please the office in charge of the form.
Or the user is asked to proceed to complete the form if it is the first time s/he is completing the form.
In this case, after testing your solution, the message is not displaying and none of the boxes is getting populated.
I had created a screenshot but unfortunately, there is no way (that I know of) to post it here.
|
|
|
|
|
There should only be two cases where the status label doesn't have a message:
- The
txtEmpID control is empty; - The stored procedure returned a row which was neither for this year nor the previous year;
You'll need to debug the code to see which is happening. Perhaps add a different message in the final Else ' Not this year, nor the previous year block.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If I temporarily comment this out:
' Clear the controls:
'txteName.Text = String.Empty
'txttitle.Text = String.Empty
'txtemail.Text = String.Empty
'txtEmpID.Text = String.Empty
'lblStatus.Text = String.Empty
'Gridview1.DataSource = Nothing
'Gridview1.DataBind()
it works but doesn't work if they are not commented out if I am using the correct empID with previous year's date and doesn't show the message: Not this year, nor the previous year even though I added that message to the Else block.
|
|
|
|
|
I suspect you just need to comment out the line:
txtEmpID.Text = String.Empty since that control is used further down to populate the parameter for the query.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks as always for your help.
I really, really appreciated it.
It is working real well now.
|
|
|
|
|
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.
|
|
|
|
|
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!
<asp:GridView CssClass="datatable" ShowFooter="false" ShowHeaderWhenEmpty="true" DataKeyNames="ProfileTermID" DataSourceID="ldsTerms" ID="gvTerms" OnDataBound = "OnDataBound" OnRowCommand="gvTerms_RowCommand" runat="server" AutoGenerateColumns="False">
<HeaderStyle BackColor="#999999" ForeColor="#ffffff" />
<RowStyle CssClass="divRow" />
<EditRowStyle BackColor="#b3d4e8" Height="50px" VerticalAlign="Middle" HorizontalAlign="Center" />
<FooterStyle BackColor="#b3d4e8" Height="50px" VerticalAlign="Middle" HorizontalAlign="Center" />
<EmptyDataTemplate>
Legislator Has No Terms
</EmptyDataTemplate>
<Columns>
<asp:BoundField DataField="ProfileID" HeaderText="ProfileID" />
<asp:TemplateField HeaderText="Term Start Date" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<telerik:RadDatePicker ID="rdtTermStart" Skin="Metro" runat="server" SelectedDate='<%#Eval("TermStartDate")%>'>
</telerik:RadDatePicker>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("TermStartDate", "{0:d}")%>
</ItemTemplate>
<FooterTemplate>
<telerik:RadDatePicker ID="rdtTermStartF" Skin="Metro" runat="server">
</telerik:RadDatePicker>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="TermEndDate" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<telerik:RadDatePicker ID="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:RadDatePicker ID="rdtTermEndF" Skin="Metro" runat="server">
</telerik:RadDatePicker>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Chamber" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="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:DropDownList ID="ddChamberF" AutoPostBack="true" OnSelectedIndexChanged="ddChamberF_SelectedIndexChanged" DataSourceID="ldsChambers" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Party" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="ddParty" DataSourceID="ldsParties" DataTextField="Name" DataValueField="ID" runat="server" SelectedValue='<%# Bind("PartyID") %>'>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mod_party.name")%>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddPartyF" DataSourceID="ldsParties" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="District" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="ddDistrict" DataSourceID="ldsDistricts" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mod_district.name")%>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddDistrictF" DataTextField="Name" DataValueField="ID" runat="server" >
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="County" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="ddCounty" DataSourceID="ldsCounty" DataTextField="Name" DataValueField="ID" runat="server" SelectedValue='<%# Bind("CountyID") %>'>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mod_county.name")%>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddCountyF" DataSourceID="ldsCounty" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ShowHeader="False" ItemStyle-CssClass="divCell" ItemStyle-Height="34px">
<EditItemTemplate>
<asp:ImageButton ID="ImageButton6" runat="server" CausesValidation="False" CommandName="Update" Text="Update" ToolTip="Update" ImageUrl="/admin/images/success.png" />
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False" CommandName="Insert" ToolTip="Insert" Text="Insert" ImageUrl="/admin/images/success.png" />
</FooterTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" ImageUrl="/admin/images/ico_edit_a.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ShowHeader="False" ItemStyle-CssClass="divCell" ItemStyle-Height="34px">
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" ImageUrl="/admin/images/ico_delete_a.png" />
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" ImageUrl="/admin/images/ico_subtract.png" />
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="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:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Profiles" EnableDelete="True">
</asp:LinqDataSource>
<asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
EnableInsert="True" EnableUpdate="True" TableName="mod_Profiles" Where="ID == @ID">
<WhereParameters>
<asp:ControlParameter ControlID="lvContent" DefaultValue="0" Name="ID" PropertyName="SelectedValue"
Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsTerms" runat="server" ContextTypeName="CMSmodules.ModulesDataContext" EntityTypeName="" TableName="mod_ProfileTerms" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsDistricts" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Districts" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsParties" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Parties" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsChambers" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Chambers" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsCounty" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Counties" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsSessions" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Sessions" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
|
|
|
|
|
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 ?
|
|
|
|
|
If it's presented as a standard download it might well be a header or CORS issue.
If it's an async download, the error likely lies in the javascript running in the browser.
Determine the download method, check the crapple browser API, and play "spot the difference".
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Thanks for your reply,
I will investigate over the things you suggest
But the very strange thing is that the same server configuration worked up to 4 weeks ago and everything is working well in Android or windows
Also we tried several browser as an alternative to Safari, all getting the same results... Is there in your opinion a chance of a bug in ios?
|
|
|
|
|
A lot of configurations, such as what encryption standards are acceptable, can be configured at the OS level; it's possible that they locked it down further. The odds of that serious a bug in something as well traversed as the network stack are unlikely.
Can you get wireshark on a client and see what's happening? That would allow you to troubleshoot the TLS handshake, and the overall traffic flow in general.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
It was simpler: ios Doesn't accepts octet-streams mime type...
|
|
|
|
|
Ah, ignoring the standard. There's a shock.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
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:ListView ID="ListViewOrderRow"
runat="server"
DataKeyNames="rowguid"
DataSourceID="SqlDataSource1"
OnDataBound="ListViewOrderRow_DataBound">
<asp:Label ID="afp_nrLabel" runat="server" Text='<%# Eval("afp_nr") %>'></asp:Label>
<asp:Label ID="auf_trnrLabel" runat="server" Text='and lots more stuff like this'></asp:Label>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStringFDS %>"
ProviderName="<%$ ConnectionStrings:ConnectionStringFDS.ProviderName %>"
SelectCommand="sp_Warehouse_RowsByOrderNumberAndWarehouse"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Direction="Input"
DefaultValue="x"
Name="@OrderNumber"
QueryStringField="afp_nr"
Type="String" />
<asp:QueryStringParameter Direction="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.
|
|
|
|
|
Try omitting the "@" from the name
<asp:QueryStringParameter Direction="Input"
DefaultValue="x"
Name="OrderNumber"
QueryStringField="afp_nr"
Type="String" />
<asp:QueryStringParameter Direction="Input"
DefaultValue="x"
Name="Warehouse"
QueryStringField="wh_nr"
Type="String" />
|
|
|
|
|
Hi,
Thanks for your reply. I omitted the @ characters, but unfortunately still no sigare.
Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
|
Why this code shows two images instead of one
protected void Page_Load(object sender, EventArgs e)
{
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);
}
|
|
|
|
|
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.
|
|
|
|
|
What exactly are you asking us to do?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
To dynamically put the lowest rate data on top while my website is fetching the data from different sources and also to show the progresss bar.
|
|
|
|
|
That is a lot of different things and a lot of different code. I don’t think anyone is going to write that code for you, so where exactly are you stuck?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
You may want to think of building a WebService which executes in the background and one of the methods on that WebService is to return the progress of fetching data.
Kind of a "BlueSky" answer, but building WebSites fetching lots of data which takes a long time can be quite a challenge.
|
|
|
|