Gregarious greetings and sincere salutions,
The custom validaor that I coded on one page of this web app works fine. When the page loads, the error messages from the custom validator event about the need to enter data into certain fields do not show. When the Submit button is clicked, the validator's error messages that I coded about the need to enter data into certain fields do show when those fields are empty.
But I did the same for a different page and I'm having a problem. When the page first loads, the code goes from the End Sub line of the page load directly to the beginning of the custom validator's event and therefore the custom error messages about the need to enter data into certain fields show even though the page has loaded for the first time and even though the user has yet to click the Submit button.
Here is the part of the HTML code for this problem. It is the btnAddCriticalIncident and the custom validator valAddCritical.
Various HTML code and then
<tr>
<td>
<asp
anel id="pnlValidation" Runat="server" visible="false">
<table>
<tr>
<td>
<asp:Button ID="btnAddCriticalIncident" runat="server" Text="SUBMIT CRITICAL INCIDENT"
PostBackUrl="~/add_critical_incidents.aspx" ValidationGroup="valAddCriticalIncident" />
</td>
</tr>
<tr>
<td>
<asp:CustomValidator ID="valAddCritical" runat="server"
ErrorMessage="CustomValidator"
ValidationGroup="valAddCriticalIncident" ForeColor="gray"></asp:CustomValidator>
</td>
</tr>
</table>
</asp
anel>
</td>
et cetera
Inside of the page load, there is code in the Else part of an If to open the above panel.
Then I of course have code in the custom validator to force the user to enter data into certain fields, ensure that future dates are not used, et cetera (Protected Sub valAddCritical_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valAddCritical.ServerValidate). The Submit button has CausesValidation set to True, so when Submit is clicked the custom validation should occur and indeed does occur when the Submit button is clicked.
I have debugged line by line and I don't know why the program goes from the End Sub line of the VERY FIRST Page Load directly to the beginning of the Protected Sub valAddCritical_ServerValidate.
This is in VB.NET 2005 (Page Language = VB).
Any ideas would be greatly appreciated.
The custom validaor that I coded on one page of this web app works fine. When the page loads, the error messages from the custom validator event about the need to enter data into certain fields do not show. When the Submit button is clicked, the validator's error messages that I coded about the need to enter data into certain fields do show when those fields are empty.
But I did the same for a different page and I'm having a problem. When the page first loads, the code goes from the End Sub line of the page load directly to the beginning of the custom validator's event and therefore the custom error messages about the need to enter data into certain fields show even though the page has loaded for the first time and even though the user has yet to click the Submit button.
Here is the part of the HTML code for this problem. It is the btnAddCriticalIncident and the custom validator valAddCritical.
Various HTML code and then
<tr>
<td>
<asp
<table>
<tr>
<td>
<asp:Button ID="btnAddCriticalIncident" runat="server" Text="SUBMIT CRITICAL INCIDENT"
PostBackUrl="~/add_critical_incidents.aspx" ValidationGroup="valAddCriticalIncident" />
</td>
</tr>
<tr>
<td>
<asp:CustomValidator ID="valAddCritical" runat="server"
ErrorMessage="CustomValidator"
ValidationGroup="valAddCriticalIncident" ForeColor="gray"></asp:CustomValidator>
</td>
</tr>
</table>
</asp
</td>
et cetera
Inside of the page load, there is code in the Else part of an If to open the above panel.
Then I of course have code in the custom validator to force the user to enter data into certain fields, ensure that future dates are not used, et cetera (Protected Sub valAddCritical_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valAddCritical.ServerValidate). The Submit button has CausesValidation set to True, so when Submit is clicked the custom validation should occur and indeed does occur when the Submit button is clicked.
I have debugged line by line and I don't know why the program goes from the End Sub line of the VERY FIRST Page Load directly to the beginning of the Protected Sub valAddCritical_ServerValidate.
This is in VB.NET 2005 (Page Language = VB).
Any ideas would be greatly appreciated.