Hi Folks,
I have a situation where the OnClick attribute is firing before my validation controls and it's causing an error when attempting to add a row to my table. I generate this error when I key in an invalid zip code(123A5). How can I prevent this from happening?
<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" Width="60px" />
<asp:TextBox ID="txtZIPCOD" runat="server" Width="171px" MaxLength="5"></asp:TextBox></td>
<td align="left" style="width: 325px" valign="top">
<asp:RangeValidator ID="Zip_Code_Validator" runat="server" ControlToValidate="txtZIPCOD" MaximumValue="99999"
MinimumValue="1" Type="Integer" Width="265px" SetFocusOnError="True" Display="None" ErrorMessage="Zip Code must be 5 digits (00001 - 99999)"></asp:RangeValidator></td>
I have a situation where the OnClick attribute is firing before my validation controls and it's causing an error when attempting to add a row to my table. I generate this error when I key in an invalid zip code(123A5). How can I prevent this from happening?
<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" Width="60px" />
<asp:TextBox ID="txtZIPCOD" runat="server" Width="171px" MaxLength="5"></asp:TextBox></td>
<td align="left" style="width: 325px" valign="top">
<asp:RangeValidator ID="Zip_Code_Validator" runat="server" ControlToValidate="txtZIPCOD" MaximumValue="99999"
MinimumValue="1" Type="Integer" Width="265px" SetFocusOnError="True" Display="None" ErrorMessage="Zip Code must be 5 digits (00001 - 99999)"></asp:RangeValidator></td>