Click here to Skip to main content
15,916,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Following required field validator is not working.
Please resolve.
Thanks

<pre lang="HTML">

<asp:TextBox ID="txtOECCSecurityCode" runat="server" CssClass="textbox3" Width="350"></asp:TextBox>
<asp:RequiredFieldValidator ID="refOECCSecurityCode" runat="server" ControlToValidate="txtOECCSecurityCode" Display="Dynamic" ErrorMessage="" Font-Size="11px" ForeColor="Red" ValidationGroup="vgOE">Security Code required</asp:RequiredFieldValidator>


button code as follow

VB
<asp:Button ID="btnEPSubmit" runat="server" Text="Submit" CssClass="button" OnClick="btnEPSubmit_Click"
 OnClientClick="return showContent()" ValidationGroup="vgEP" style="height: 26px" />
Posted
Comments
Thomas ktg 16-Sep-13 5:30am    
Check the validation group you have given for both.
[no name] 16-Sep-13 5:46am    
Your right
Thanks Thomas

1 solution

Hi,
This validation does not work, because on button click you are firing onclientclick event. which overrides RequiredFieldValidator. Also, RequiredFieldValidator having ValidationGroup="vgOE" and Button having ValidationGroup="vgEP". This both validationgroup should be same. 

Hope it helps.
Thanks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900