validation in datagrid

Last post 07-11-2007 6:26 PM by rmaiya. 1 replies.

Sort Posts:

  • validation in datagrid

    07-11-2007, 4:10 PM
    • Loading...
    • sthauttam
    • Joined on 01-03-2007, 6:10 PM
    • Posts 75

    Hi guys! 

     I am getting trouble to put validation in the datagrid. Could you please help me? I have two fields in datagrid, one is age column and another is sex. For both column i have kept the textbox. I have used template column for both. Now how can i validate the age field with numeric only and sex field  with character only?. I am using Asp.net 2.0 and C#.

     I would appreciate your help.

     Thanks,

     

  • Re: validation in datagrid

    07-11-2007, 6:26 PM
    Answer
    • Loading...
    • rmaiya
    • Joined on 06-25-2007, 7:08 PM
    • Olympia, WA
    • Posts 1,237

    Use compare validator, and put those validation next to your text boxes.

     

    <EditItemTemplate>
                                    
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>   <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="CompareValidator" ControlToValidate="TextBox2"></asp:CompareValidator>
                                    </EditItemTemplate>

    Raghu
    (MCSD.NET, MCAD.NET, MCDBA)
    [Don't forget to click on Mark as answer on the post that helped you ]
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter