-
Not able to access dynamically created textboxes in a gridview using Javascript
Hi,
For e.g i need to display a list of employees. So in my gridview i have my first column as EmpName and 2nd and 3rd column and 4th column as template field with textboxes.
So for n number of employees , n number of textboxes would be created dynamically.
I need to access these textboxes in the javascript, as i need to add the values in 2nd and 3rd column and polpulate them in 4th column of each rowin a grid onblur of the 2nd column .
Can anyone let me know how can i get access to these controls (to add the values) in Javascript?
ASPx page
<asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:BoundField DataField="EmpName" HeaderText="EmpName" />
<asp:TemplateField HeaderText="Value1">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Value2">
<ItemTemplate>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Value3">
<ItemTemplate>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Thanks,
Mathew
-
HI matthew
you can get reference of text box by prefixing the grid id you give
once the page gets loaded into browser grid becomes a table and it will have the same id as grid and whatever the objects that you placed inside the grid will have the id of the grid and its own id but seperated with '_'.
Now using the getElementsById or GetElementsByName against the document object of javascript you can get the reference of text box 
hope this helps you
Similar Threads
-
By msJones in forum ASP.NET
Replies: 2
Last Post: 09-08-2003, 02:33 AM
-
By Lela in forum VB Classic
Replies: 1
Last Post: 01-30-2003, 09:03 AM
-
By Rudolph Jones in forum VB Classic
Replies: 0
Last Post: 05-16-2001, 05:24 PM
-
By amukelani shandlale in forum Web
Replies: 1
Last Post: 04-24-2001, 11:46 AM
-
By Murray Foxcroft in forum Web
Replies: 5
Last Post: 11-02-2000, 03:42 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|