<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   
   
    &nbsp; &nbsp; &nbsp;<a href ="default.aspx">Back </a>  &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp;
<a href="default4.aspx">Log out</a>
    <br />

    <table border="0" cellpadding="0" cellspacing="0" height="20" width="100%" id="TABLE1" language="javascript" onclick="return TABLE1_onclick()">
        <tr>
            <td align="center" bgcolor="#ffce9d" colspan="6" style="height: 20px" width="100%">
                <font color="#800000" face="Verdana" size="2">Particulars of litigation pending against IDBI Homefinance Ltd.</font></td>
        </tr>
    </table>
    &nbsp; &nbsp; &nbsp;
    <asp:Panel ID="Panel1" runat="server" Height="120px" Width="752px">
        <asp:Label ID="Label1" runat="server" Text="Customer Name"></asp:Label>
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:Label ID="Label2" runat="server" Text="Case No."></asp:Label>
        &nbsp; &nbsp;&nbsp; &nbsp;<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
        <asp:Label ID="Label3" runat="server" Text="Start Date" Width="96px"></asp:Label>
        &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<asp:Label
            ID="Label4" runat="server" Text="Amount" Width="56px"></asp:Label>
        &nbsp; &nbsp; &nbsp; &nbsp;<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br />
        <asp:Label ID="Label5" runat="server" Text="Case Cateogry" Width="104px"></asp:Label>
        &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Width="152px">
            <asp:ListItem Value="Consumer Case"></asp:ListItem>
            <asp:ListItem Value="Other Case"></asp:ListItem>
        </asp:DropDownList>
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<asp:Label
            ID="Label6" runat="server" Text="Branch Name"></asp:Label>&nbsp;
        <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" Width="152px">
            <asp:ListItem>Pune</asp:ListItem>
        </asp:DropDownList><br />
        <asp:Label ID="Label7" runat="server" Text="Court Type" Width="80px"></asp:Label>
        &nbsp; &nbsp;
        <asp:RadioButton ID="RadioButton1" runat="server" GroupName="courttype" Text="High Court"
            Width="96px" />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:RadioButton ID="RadioButton2" runat="server" GroupName="courttype" Text="Supreme Court "
            Width="128px" /><br />
        <asp:Label ID="Label8" runat="server" Text="Case Type" Width="80px"></asp:Label>
        &nbsp; &nbsp;
        <asp:RadioButton ID="RadioButton3" runat="server" GroupName="casetype" Text="Case filed by Barrower" />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        &nbsp; &nbsp; &nbsp;<asp:RadioButton ID="RadioButton4" runat="server" GroupName="casetype"
            Text="Case filed by Customer" /><br />
        <asp:Label ID="Label9" runat="server" Text="Breif Particulars" Width="128px"></asp:Label><br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:TextBox ID="TextBox5" runat="server" Height="64px" Width="600px"></asp:TextBox><br />
        <br />
        <asp:Label ID="Label10" runat="server" Text="Current Status" Width="120px"></asp:Label><br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:TextBox ID="TextBox6" runat="server" Height="64px" Width="608px"></asp:TextBox><br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Save" OnClientClick = "return confirm('Are you sure you want to save record?');"/>
        <asp:Button ID="Button1" runat="server" Text="Reset" OnClick="Button1_Click" /></asp:Panel>
    <br />
    <asp:Panel ID="Panel2" runat="server" Height="50px" Width="304px">
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
            ErrorMessage="RequiredFieldValidator" Width="176px">Enter Customer Name</asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
            ErrorMessage="RequiredFieldValidator" Width="176px">Enter Case Number.</asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox3"
            ErrorMessage="RequiredFieldValidator" Width="176px">Enter Start Date of case.</asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox4"
            ErrorMessage="RequiredFieldValidator" Width="176px">Enter Amount</asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="DropDownList2"
            ErrorMessage="RequiredFieldValidator" Width="176px">Select Branch Name.</asp:RequiredFieldValidator>&nbsp;
        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="DropDownList1"
            ErrorMessage="RequiredFieldValidator" Width="176px">Select Case Category.</asp:RequiredFieldValidator></asp:Panel>
    &nbsp;
    <br />
</asp:Content>

i have written above for validation, but when i click on save button, control directly goes to C# coding, n this validation did not get executed.

hi,

For each of the validation controls, you need to add one more attribute 'ValidationGroup'. This should be same for all the controls say 'vg'. Also add this attribute to the Submit button and then it should work fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.