Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Accessing dynamic radio buttons

Reply
Thread Tools

Accessing dynamic radio buttons

 
 
UJ
Guest
Posts: n/a
 
      06-09-2005
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.


 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      06-09-2005
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/...ewstate&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.
>




 
Reply With Quote
 
 
 
 
UJ
Guest
Posts: n/a
 
      06-09-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...
> 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/...ewstate&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.
>>

>
>
>



 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      06-09-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ...
>
>> 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/...tnet.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.
>>>




 
Reply With Quote
 
UJ
Guest
Posts: n/a
 
      06-10-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) ...
>>
>>> 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/...tnet.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.
>>>>

>
>
>



 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      06-10-2005
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



> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ...
>
>> 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" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed) ...
>>>
>>>> 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/...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.
>>>>>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Created Radio Buttons displaying as if they were conventional buttons Dr. Leff Javascript 3 10-15-2007 09:47 PM
Created Radio Buttons displaying as if they were conventional buttons Dr. Leff Javascript 3 10-15-2007 05:18 AM
ASP.NET Reset Radio Button in a group of Radio Buttons Scott D Johnson ASP .Net 1 09-27-2006 10:38 PM
getElementsByName undefined for dynamic elements (radio buttons) Saul Javascript 22 05-16-2006 06:09 PM
Dynamic radio buttons matrix using Struts Antonietta Tobito via JavaKB.com Java 2 02-02-2005 11:47 PM



Advertisments