access dynamically added controls
Dear All,
Im using ASP.NET 2.0 with C#.
In my aspx page, i have one HTML Table.
Using the javascript i add the rows dynamically.
1.What my problem is how can i access those controls.
When i click the submit button, i lose all those rows that were
added dynamically.
How can i persist those rows and how can i access the controls.
2.Also 'm using many checkboxes in cell2 of each row.
I want to manipulate whether it's checked or not. So i count the
number of checkboxes and loop through all the controls,
so that i validate whether it's checked or not. How can i count the
controls. Is there any syntax in Javascript like this
Cell2.Controls.Count ?
Help me to over come this problem...
Thanks a lot.
Regards
Raja.
Date:Thu, 07 Jun 2007 22:33:33 -0700
Author:
|
Re: access dynamically added controls
You'd need to work the creation of the controls on the server-side (pass
information from client to server what to create). It can take some cycles,
and if you want it look like that to the user, you could just use ASP.NET
Ajax's UpdatePanel, this way you'd develop like for client-side but it looks
like as if it happens at the client.
JavaScript does have syntac for that. You'd iterate though form's elements
or childNodes of a given node or then like this:
http://geekswithblogs.net/mparsons/archive/2006/03/02/71175.aspx there are
lots of alternatives
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
wrote in message
news:1181280813.784585.161700@n15g2000prd.googlegroups.com...
> Dear All,
>
> Im using ASP.NET 2.0 with C#.
> In my aspx page, i have one HTML Table.
> Using the javascript i add the rows dynamically.
>
> 1.What my problem is how can i access those controls.
> When i click the submit button, i lose all those rows that were
> added dynamically.
> How can i persist those rows and how can i access the controls.
>
> 2.Also 'm using many checkboxes in cell2 of each row.
> I want to manipulate whether it's checked or not. So i count the
> number of checkboxes and loop through all the controls,
> so that i validate whether it's checked or not. How can i count the
> controls. Is there any syntax in Javascript like this
> Cell2.Controls.Count ?
>
> Help me to over come this problem...
> Thanks a lot.
> Regards
> Raja.
>
Date:Wed, 13 Jun 2007 20:04:05 +0300
Author:
|