Hello,
I need to be able to add dynamically created textboxes to my Grid rows. I'm doing that in the grid's ItemCreated event. However, on post back my text boxes are being recreated and therefore losing their values. I don't want to have to recreat my textbox controls in Page_Init. I had an idea to read the textbox values on the client side and write them to a hidden field control. The problems is that I can't figure out how to access the SelectedRow's controls collection to find my text boxes.
Also, the number of text boxes per row is also dynamic. Meaning Row 1 may have just 1 textbox while Row 2 has 3. This is why i need to be able to dynamically loop the row's controls since I won't know exactly how many text boxes were created for a given row
Here is what I'm trying to do
I'm getting a javascript error that controls.count is null
I need to be able to add dynamically created textboxes to my Grid rows. I'm doing that in the grid's ItemCreated event. However, on post back my text boxes are being recreated and therefore losing their values. I don't want to have to recreat my textbox controls in Page_Init. I had an idea to read the textbox values on the client side and write them to a hidden field control. The problems is that I can't figure out how to access the SelectedRow's controls collection to find my text boxes.
Also, the number of text boxes per row is also dynamic. Meaning Row 1 may have just 1 textbox while Row 2 has 3. This is why i need to be able to dynamically loop the row's controls since I won't know exactly how many text boxes were created for a given row
Here is what I'm trying to do
function RowSelected(row)
{
for (i=0;i<row.Controls.count;i++)
{
if (row.Controls[i].type == "text")//if the type of control is textbox
{
alert(row.Controls[i].id);
}
}
}
I'm getting a javascript error that controls.count is null
How can I accomplish this task? It's doesn't have to be the same solution as outlined above. I just need to be able to create those text boxes at run time and access their values on the server at postback.
Thanks in advance ;)