What is the use of Validation Group?

Posted by Iluvdotnetfunda under ASP.NET on 4/27/2012 | Points: 10 | Views : 7722 | Status : [Member] | Replies : 5
Hello Friends,


What is the use of Validation Gruop?


iluvdotnetfunda




Responses

Posted by: Somasundaram on: 4/27/2012 [Member] Starter | Points: 25

Up
0
Down
using Validation Group we can specify the controls which are to be validated...

For Eg:
Pls Check this link,

http://www.w3schools.com/aspnet/showasp.asp?filename=demo_prop_webcontrol_imagebutton_validationgroup

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 5/23/2012 [Member] Starter | Points: 25

Up
0
Down
VALIDATION GROUP IS USED FOR ALL CONTROL VALIDATED OR NOT TO CHECK

THERE ARE SIX VALIDATION CONTROL AVAILABLE

REQUIRED FIELD VALIDATION
RANGE VALIDATION
REGULAR EXPRESSION VALIDATION
CUSTOM VALIDATION
VALIDATION GROUP
COMPARE VALIDATION

VALIDATION GROUP IS ALL VALIDATION CONTROL SHOULD VALIDATED OR NOT

REGARDS





sriram

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 5/23/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Dear Iluvdotnetfunda

If the answers that have been supplied here have helped you , please mark them as resolved.

Thanks

Thank you for posting at Dotnetfunda
[Administrator]

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kavi.Sirius on: 5/24/2012 [Member] Starter | Points: 25

Up
0
Down
hi,

Refer this link
http://www.dotnet-guide.com/validationgroups.html

Regards
Kavi.n

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/8/2012 [Member] Bronze | Points: 25

Up
0
Down
suppose you have four text boxes and two button. when you click the first button it validates the first two text boxes. and when you click the second button it validates the last two text boxes. if you will not use the validation group property when you will click the any button it will validate the all four text boxes and will not proceed untill you have filled all four text boxes rather than two. now when you will use validation group property you will set same validation group for first two text boxes and first button and another validation group for last two text boxes and second button. now when you click either button it will only validate the textboxes which are of the same validation group from which this button belongs.

<asp:TextBox ID="txtOne" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtOne" ErrorMessage="Required" ValidationGroup="One"></asp:RequiredFieldValidator>

<asp:TextBox ID="txtTwo" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTwo" ErrorMessage="Required" ValidationGroup="One"></asp:RequiredFieldValidator>

<asp:Button ID="Button1" runat="server" Text="Create" ValidationGroup="One" OnClick="Button1_Click"/>



<asp:TextBox ID="txtThree" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtThree" ErrorMessage="Required" ValidationGroup="Two"></asp:RequiredFieldValidator>

<asp:TextBox ID="txtFour" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFour" ErrorMessage="Required" ValidationGroup="Two"></asp:RequiredFieldValidator>

<asp:Button ID="Button2" runat="server" Text="Create" ValidationGroup="Two" OnClick="Button2_Click"/>



Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response