i am dynamically adding text box in gridview.now i enter a value in textbox and i want to compare this value with another textbox value in the client side through javascripe .can i do it. Pls help.

Dear Guptaalok12,

I will try to solve your problem. I hope it works.

<script language="javascript">
    function check(obj)
    {
        if(obj.value!=form1.TextBox1.value)
        {
            alert('False');
        }
        else
        {
            alert('True');
        }
    }
</script>

and in your GridView TextBox

<asp:TemplateField HeaderText="Remark">
     <ItemTemplate>
         <asp:TextBox ID="TxtRemark" runat="server" Width="100%" Enabled=false onblur = "check(this)"></asp:TextBox>
     </ItemTemplate>
</asp:TemplateField>

Thanks,

Kusno.

u said u r dynamically adding textboxes in u r datagrid,for that set attributes to runat at server like this

txt.attributes.add("ruant","server");
just like any other text comparision u can do the coding

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.