|
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.
|
|
|
|
|
|
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);
protected async void GetCasesButton_Click(object sender, EventArgs e)
{
if (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 Number
int newBatchNumber = await CandidateCaseController.GetNextBatchNumber();
#endregion
#region Insert entered case numbers in database
foreach (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
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
public class JusticeController
{
#region Get
public static async 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
}
|
|
|
|
|
An internal server error just means something has gone wrong in the server-side code. You'll need the actual error details to work out what the problem is.
Assuming the error is coming from the GetAllAcceptCaseNumbers method, the problem is with the service you're calling, not the code you've shown. You'll need to contact the developer(s) responsible for that service to fix the problem.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you for your response. You are exactly right. I did talk to someone and I need to get username and password the app need to use to connect to the server.
|
|
|
|
|
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
|
|
|
|
|
By default, sites are not allowed to change the Windows authentication settings.
You need to use IIS Manager to unlock that feature:
Delegating Features in IIS Manager | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I resolved this issue changed the following
from
<section name="windowsAuthentication" overrideModeDefault="Deny" />
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
<add name="AnonymousAuthenticationModule" lockItem="true" />
<add name="WindowsAuthenticationModule" lockItem="true" />
to
<section name="windowsAuthentication" overrideModeDefault="Allow" />
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<add name="AnonymousAuthenticationModule" lockItem="false" />
<add name="WindowsAuthenticationModule" lockItem="false" />
in the applicationhost.config file under the solution folder
|
|
|
|
|
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
<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>
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
modified 30-Jan-20 14:12pm.
|
|
|
|
|
I can't see anything in that code which would bind data to the GridView. There's no DataSourceID or SelectMethod on the GridView, and nothing in the code that sets the DataSource .
There's also no sign of the txtEmpID control, and the CType((CType(sender, TextBox)).Parent.Parent.Parent.Parent, GridViewRow) looks suspicious to me.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
Always great to hear from you.
Thank you for the feedback.
I tried this code:
Private Sub fillSourceRecords()
Dim conn_str As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Using con As SqlConnection = New SqlConnection(conn_str)
Using sourcecmd As SqlCommand = New SqlCommand()
sourcecmd.CommandText = "uspGetEthicsRecs"
sourcecmd.CommandType = CommandType.StoredProcedure
sourcecmd.Parameters.AddWithValue("@empID", txtEmpID.Text.Trim())
sourcecmd.Connection = con
Using sda As SqlDataAdapter = New SqlDataAdapter(sourcecmd)
Dim dt As DataTable = New DataTable()
sda.Fill(dt)
Gridview1.DataSource = dt
Gridview1.DataBind()
End Using
End Using
End Using
End Sub
And then on the ValidateEmp sub, I would call this routine as:
fillSourceRecords()
The problem with this code is that even though it displays data on the gridview.
However, when I enter another empID, it doesn't replace the original data with the data that is associated with the current empID.
This is one of those applications that uses gridview to add dynamic rows as needed.
It is a lot of code and very complicated. It took almost six months to get it to work with some of the help coming from you.
If you would like to see the rest of code, please let me know as the solution that I am looking for may be hidden in one of the codes but I am not able to figure it out.
|
|
|
|
|
samflex wrote: However, when I enter another empID, it doesn't replace the original data with the data that is associated with the current empID.
That method should replace the contents of the grid with the loaded data. Are you sure the method is being called?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, sir.
I removed it from the code I posted here yesterday.
Sorry to post the code again but this is how I was calling it:
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()
fillSourceRecords() <--
'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
Notice that I commented out txtsource and txtspouse.
The point that is worth mentioning which was a problem is that when I enter empID to valid, even the it displays contents of the grid from the DB, the information display on the code below stays the same. It doesn't change to show that the employee, employee's title and email from code below is the same as the contents of the grid even they are all validated using the txtEmpID_TexChanged(...) method:
<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>
modified 30-Jan-20 11:27am.
|
|
|
|
|
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?
|
|
|
|
|