Hi experts,

I need a validator in my gridview.
When the user update a field in the gridview, I need to check if the email is valid.
How can I do that?

Below is my gridview.
Please help. Thanks!

<asp:GridView ID="gv_retrieve" runat="server" AutoGenerateColumns="False" CellPadding="3"
        ForeColor="Black" GridLines="Vertical" Width="751px" OnRowEditing="gv_retrieve_RowEditing" 
        OnRowUpdating="gv_retrieve_RowUpdating" onRowCancelingEdit = "gv_retrieve_RowCancelingEdit" 
        OnRowDeleting = "gv_retrieve_RowDeleting" OnRowDataBound = "gv_retrieve_RowDataBound"
        BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" Font-Bold="False">
        <FooterStyle BackColor="#CCCCCC" />
            <asp:BoundField DataField="Name" HeaderText="Name" />
            <asp:BoundField DataField="Designation" HeaderText="Designation" />
            <asp:BoundField DataField="Email" HeaderText="Email Address" />
            <asp:BoundField DataField="WatcherEmail" HeaderText="Watcher Email" />
            <asp:CommandField ShowEditButton="True" >
                <ItemStyle Width="35px" />
            <asp:CommandField ShowDeleteButton="True" />
            <asp:BoundField DataField="apid">
                <ItemStyle CssClass="hiddencol" />
            <table width="100%">
                <tr style="font-weight:bold; text-decoration:underline" align="center">
             <br />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#CCCCCC" />

I never had an inline grid editing form before (I try to separate editing to a different form) but you should try and dynamically add the validation control in the item data bound event (pay attention to the row type (edit)). You could also just check the entry after the post back and keep the grid in edit mode, displaying an error message on top of the page if you did not like the value entered.

Are you familiar with Ajax control toolkit ?
If not then you can find it in google website and get a download of that and add the .dlls
to your application and u can use them for any type of control.

Alternatively, you could create a templateField for the fields you want to validate, and use an ASP.NET validator control in that templateField. I've had that work without issue...

It does require knowledge of templateFields. Fortunately MSDN has good documentation on them: