Validation Controls
-
Hi, This is the situation...Now i have 2 requiredfield validators for 2 texboxes, one save button and one cancel button. When i click save button the 2 validators must be raised. When i click the cancel only one validator for one textbox should be raised. Plz help me, how is this possible.... thanx, yamini
-
Hi, This is the situation...Now i have 2 requiredfield validators for 2 texboxes, one save button and one cancel button. When i click save button the 2 validators must be raised. When i click the cancel only one validator for one textbox should be raised. Plz help me, how is this possible.... thanx, yamini
For this u have to create 3 validators. Apply 2 validators for save button and 1 validator for cancel button. Check the Validation Group property in Save button and its validators, Apply the same name for both. Apply the different Validation Group name for cancel button. Shahzad Aslam Software Engineer
-
Hi, This is the situation...Now i have 2 requiredfield validators for 2 texboxes, one save button and one cancel button. When i click save button the 2 validators must be raised. When i click the cancel only one validator for one textbox should be raised. Plz help me, how is this possible.... thanx, yamini
Validation group will solve your problem ...check out this .. <asp:TextBox ID="TextBox1" Runat="server" ValidationGroup="First"></asp:TextBox> <asp:TextBox ID="TextBox2" Runat="server" ValidationGroup="First"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ValidationGroup="First" ErrorMessage="TextBox1 should not be blank" ControlToValidate="TextBox1"> </asp:RequiredFieldValidator> <asp:Button ID="Submit1" Runat="server" ValidationGroup="First" Text="Submit 1" /><asp:TextBox ID="TextBox3" Runat="server" ValidationGroup="Second"></asp:TextBox> <asp:TextBox ID="TextBox4" Runat="server" ValidationGroup="Second"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server" ErrorMessage=" TextBox3 should not be blank" ControlToValidate="TextBox3" ValidationGroup="Second"> </asp:RequiredFieldValidator> <asp:Button ID="Submit2" Runat="server" ValidationGroup="Second" Text="Submit 2" />
-
For this u have to create 3 validators. Apply 2 validators for save button and 1 validator for cancel button. Check the Validation Group property in Save button and its validators, Apply the same name for both. Apply the different Validation Group name for cancel button. Shahzad Aslam Software Engineer
thanx its working