By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Accessing dynamically created controls from code-behind

P: n/a
Hello,

I am dynamically creating checkboxes on my web page based on data in a
SQL Server table. Therefore, these checkboxes do not exist at design
time and I cannot refer to them in my server-side code at design time.

Once the page is submitted, how can I access these checkboxes in my
code-behind?

Thanks for the help,

Steve
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can use Request.Form["controlName"] to access them. this is for just
reading the value.

Av.

"Steve Black" <St*********@EagleCCI.com> wrote in message
news:7d**************************@posting.google.c om...
Hello,

I am dynamically creating checkboxes on my web page based on data in a
SQL Server table. Therefore, these checkboxes do not exist at design
time and I cannot refer to them in my server-side code at design time.

Once the page is submitted, how can I access these checkboxes in my
code-behind?

Thanks for the help,

Steve

Nov 18 '05 #2

P: n/a


I see. Thank you.

However, now I have a follow-up question. How can I access
dynamically-defined attributes of my radio button (I accidentally said
checkbox before but I meant radio button)?

I am creating my radio buttons as follows:

rdBtn = New RadioButton
With rdBtn
.ID = ....
.GroupName = "GroupName"
.Attributes.Add(Key1, Value1)
.Attributes.AdD(Key2, Value2)
End With

I then add this radio button (and many others with the same Group Name)
to the web page.

I see that when I submit the page and I try Request.Form("GroupName"), I
can get the ID of the selected radio button. However, I'm not sure how
to access the Attributes which are critical to my application.

Thanks again,

Steve

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.