|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Accessing dynamic radio buttonsI have a placeholder where I dynamically add radio buttons based on values
from a DB. It's all one group. How can I access them so that I know which one is selected? I've tried both input type="radio" and asp:radiobutton I can't seem to add a checked.changed event to the radiobutton and when I search through the assorted controls on the page, I can't find the control anywhere (through code.) TIA - Jeffrey. This is all possible. When there is a postback you need to recreate the same
controls that you had previouly dynamically created. Here's a sample that shuld get you started: http://groups-beta.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c450?q=brock+dynamic+controls+viewstate&rnum=1 -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > I have a placeholder where I dynamically add radio buttons based on > values from a DB. It's all one group. How can I access them so that I > know which one is selected? > > I've tried both input type="radio" and asp:radiobutton > > I can't seem to add a checked.changed event to the radiobutton and > when I search through the assorted controls on the page, I can't find > the control anywhere (through code.) > > TIA - Jeffrey. > Brock,
Thanks I think. But that doesn't really answer my question. I have the creation of the radiobuttons working fine. The problem is - I need to know which radio button is selected. Any suggestions? TIA. Show quoteHide quote "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message news:862305632539193679599456@msnews.microsoft.com... > This is all possible. When there is a postback you need to recreate the > same controls that you had previouly dynamically created. Here's a sample > that shuld get you started: > > http://groups-beta.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c450?q=brock+dynamic+controls+viewstate&rnum=1 > > -Brock > DevelopMentor > http://staff.develop.com/ballen > > > >> I have a placeholder where I dynamically add radio buttons based on >> values from a DB. It's all one group. How can I access them so that I >> know which one is selected? >> >> I've tried both input type="radio" and asp:radiobutton >> >> I can't seem to add a checked.changed event to the radiobutton and >> when I search through the assorted controls on the page, I can't find >> the control anywhere (through code.) >> >> TIA - Jeffrey. >> > > > When you dynamically create them handle the SelectedindexChanged event. The
first paramater is the sender of the event, which will be your RadioButtonList. Or am I still missing what you're trying to do? -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > Brock, > Thanks I think. But that doesn't really answer my question. I have the > creation of the radiobuttons working fine. The problem is - I need to > know > which radio button is selected. > Any suggestions? > > TIA. > > "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message > news:862305632539193679599456@msnews.microsoft.com... > >> This is all possible. When there is a postback you need to recreate >> the same controls that you had previouly dynamically created. Here's >> a sample that shuld get you started: >> >> http://groups-beta.google.com/group/microsoft.public.dotnet.framework >> .aspnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c450?q=broc >> k+dynamic+controls+viewstate&rnum=1 >> >> -Brock >> DevelopMentor >> http://staff.develop.com/ballen >>> I have a placeholder where I dynamically add radio buttons based on >>> values from a DB. It's all one group. How can I access them so that >>> I know which one is selected? >>> >>> I've tried both input type="radio" and asp:radiobutton >>> >>> I can't seem to add a checked.changed event to the radiobutton and >>> when I search through the assorted controls on the page, I can't >>> find the control anywhere (through code.) >>> >>> TIA - Jeffrey. >>> I'm not using a radiobuttonlist - I have a series of radio buttons. The
reason for the individual radio buttons is that I need more layout control than what a radiobuttonlist will give me. Show quoteHide quote "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message news:863020632539245091025456@msnews.microsoft.com... > When you dynamically create them handle the SelectedindexChanged event. > The first paramater is the sender of the event, which will be your > RadioButtonList. Or am I still missing what you're trying to do? > > -Brock > DevelopMentor > http://staff.develop.com/ballen > > > >> Brock, >> Thanks I think. But that doesn't really answer my question. I have the >> creation of the radiobuttons working fine. The problem is - I need to >> know >> which radio button is selected. >> Any suggestions? >> >> TIA. >> >> "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message >> news:862305632539193679599456@msnews.microsoft.com... >> >>> This is all possible. When there is a postback you need to recreate >>> the same controls that you had previouly dynamically created. Here's >>> a sample that shuld get you started: >>> >>> http://groups-beta.google.com/group/microsoft.public.dotnet.framework >>> .aspnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c450?q=broc >>> k+dynamic+controls+viewstate&rnum=1 >>> >>> -Brock >>> DevelopMentor >>> http://staff.develop.com/ballen >>>> I have a placeholder where I dynamically add radio buttons based on >>>> values from a DB. It's all one group. How can I access them so that >>>> I know which one is selected? >>>> >>>> I've tried both input type="radio" and asp:radiobutton >>>> >>>> I can't seem to add a checked.changed event to the radiobutton and >>>> when I search through the assorted controls on the page, I can't >>>> find the control anywhere (through code.) >>>> >>>> TIA - Jeffrey. >>>> > > > So you can handle the OnCheckChanged event for the RadioButton, and in the
event handler the first parameter is the sender which is the RadioButton that was checked. I hope this helps? -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > I'm not using a radiobuttonlist - I have a series of radio buttons. > The reason for the individual radio buttons is that I need more layout > control than what a radiobuttonlist will give me. > > "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message > news:863020632539245091025456@msnews.microsoft.com... > >> When you dynamically create them handle the SelectedindexChanged >> event. The first paramater is the sender of the event, which will be >> your RadioButtonList. Or am I still missing what you're trying to do? >> >> -Brock >> DevelopMentor >> http://staff.develop.com/ballen >>> Brock, >>> Thanks I think. But that doesn't really answer my question. I have >>> the >>> creation of the radiobuttons working fine. The problem is - I need >>> to >>> know >>> which radio button is selected. >>> Any suggestions? >>> TIA. >>> >>> "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message >>> news:862305632539193679599456@msnews.microsoft.com... >>> >>>> This is all possible. When there is a postback you need to recreate >>>> the same controls that you had previouly dynamically created. >>>> Here's a sample that shuld get you started: >>>> >>>> http://groups-beta.google.com/group/microsoft.public.dotnet.framewo >>>> rk >>>> .aspnet/browse_thread/thread/5e4ba4cfe5902a4b/a5717a97bd32c450?q=br >>>> oc k+dynamic+controls+viewstate&rnum=1 >>>> >>>> -Brock >>>> DevelopMentor >>>> http://staff.develop.com/ballen >>>>> I have a placeholder where I dynamically add radio buttons based >>>>> on values from a DB. It's all one group. How can I access them so >>>>> that I know which one is selected? >>>>> >>>>> I've tried both input type="radio" and asp:radiobutton >>>>> >>>>> I can't seem to add a checked.changed event to the radiobutton and >>>>> when I search through the assorted controls on the page, I can't >>>>> find the control anywhere (through code.) >>>>> >>>>> TIA - Jeffrey. >>>>>
See "what's going on" when an "Error Creating Control" message is displayed
Table height 100% has no effect Problem using AddHandler for dynamically created WebControls modify display of RadioButtonList items Dynamic Web Control Event Handling asp:table remembering state? Parent of WebControl asp.net 1.1 wizard control Alignment of a System.Web.UI.WebControls.Image object Using html controls or asp controls |
|||||||||||||||||||||||