Click here to Skip to main content
11,719,903 members (87,220 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
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
Edited 3-Feb-11 18:28pm
Sunasara Imdadhusen at 4-Feb-11 0:22am
What's your problem?
Dwayne J. Baldwin at 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
0 Sergey Alexandrovich Kryukov 1,869
1 OriginalGriff 770
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540

Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 4 Feb 2011
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