Click here to Skip to main content
13,052,342 members (55,079 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hii Experts I have a grifview in which 3 textbox are there in the edit item template.I want to validate these textboxes with required field validation .I have done using very old fashion validation(given below).Please suggest me some new technique for validation inside gridview edit item template.If possible suggest me in javascript.Here is my source code

<asp:GridView ID="GvEditEvent" runat="server" Width="500px" AutoGenerateColumns="False" DataKeyNames="EId" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true">
            <asp:TemplateField HeaderText="Event Date">
                <asp:TextBox ID="txtEDate" Text='<%#Bind("EDate") %>' runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2"   runat="server" ControlToValidate="txtEDate" ErrorMessage="Please enter EventDate">*</asp:RequiredFieldValidator>
                  <ajaxToolkit:CalendarExtender ID="CalendarExtender2"
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("EDate") %>'></asp:Label>
               <ItemStyle Width="90px" HorizontalAlign="center" VerticalAlign="top" />
            <asp:TemplateField HeaderText="Event Details">
                <asp:TextBox ID="txtEDetails" Text='<%#Bind("EDetails") %>' TextMode="multiline" Height="150px" runat="server"></asp:TextBox>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator2"   runat="server" ControlToValidate="txtEDetails" ErrorMessage="Please enter EventDetails">*</asp:RequiredFieldValidator>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("EDetails") %>'></asp:Label>
                 <ItemStyle Width="130px" HorizontalAlign="center" VerticalAlign="top" />
            <asp:TemplateField HeaderText="EventImage">
                    <asp:FileUpload ID="fupEImage" runat="server" />
                    <asp:Image ID="Image1" ImageUrl='<%#Eval("Img")%>'  Width="100px" Height="100px" runat="server" />
                        <asp:HiddenField ID="hdnImage" Value='<%#Eval("Img")%>' runat="server" />

Is there any other way of giving validation .Because I m not able to show validation summery in the gridview
Thank You
Sandeep Mishra
Software Developer
Posted 3-Feb-11 18:19pm
Updated 3-Feb-11 18:28pm
Sunasara Imdadhusen 4-Feb-11 0:22am
What's your problem?
Dwayne J. Baldwin 8-Feb-11 3:42am
Have you tried without using ID="RequiredFieldValidator2"? It should work fine without very old javascript. :)

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
Web02 | 2.8.170713.1 | Last Updated 4 Feb 2011
Copyright © CodeProject, 1999-2017
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