Click here to Skip to main content
11,922,905 members (48,379 online)
Rate this:
Please Sign up or sign in to vote.
Dear Friends,

Am working on, C#, SqlServer 2005.

I have Two logins on one page.

for Example : I have Teachers login and students login on one page.

In Teachers login I have Two Textboxes and Submit button and also
two textboxes and submit button in students login.

So, i have one validation summary for this two logins.

Please help me, how to validate separately for this two Logins.

Posted 24-Nov-12 20:40pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You have to specify validation group for each Section. Try this.;

<html xmlns="">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
                    <asp:Panel ID="Panel1" runat="server" GroupingText="Teacher Login" Width="339px">
                        <asp:TextBox ID="TextBox1" runat="server" ValidationGroup="teacher"></asp:TextBox><asp:RequiredFieldValidator
                            ID="RequiredFieldValidator1" ErrorMessage="Please Enter teacher user name" ControlToValidate="TextBox1"
                            runat="server" ValidationGroup="teacher">*</asp:RequiredFieldValidator>
                        <asp:Button ID="Button1" runat="server" Text="Teacher Login" ValidationGroup="teacher" />
                        <asp:ValidationSummary ShowSummary="false" ID="ValidationSummary1" ShowMessageBox="true"
                            runat="server" ValidationGroup="teacher" />
                    <asp:Panel ID="Panel2" runat="server" GroupingText="Student Login" Width="337px">
                        <asp:TextBox ID="TextBox2" runat="server" ValidationGroup="stu"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
                            ErrorMessage="Please Enter Student user name" ValidationGroup="stu">*</asp:RequiredFieldValidator>
                        <asp:Button ID="Button2" runat="server" Text="Student Login" ValidationGroup="stu" />
                        <asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="true"
                            ShowSummary="false" ValidationGroup="stu" />

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151125.1 | Last Updated 25 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100