Creating ClientSide code thru PreRender

  • Thread starter =?iso-8859-1?Q?Ti=EBsto?=
  • Start date
?

=?iso-8859-1?Q?Ti=EBsto?=

Hi guys, I'm using a RadioButtonList with three options and I'm trying to get this script rendered properly

<input id="rblBillState_0" type="radio" name="rblBillState" value="0" onclick="return rblBillState_onclick(0)"/>
<input id="rblBillState_1" type="radio" name="rblBillState" value="1" onclick="return rblBillState_onclick(1)"/>
<input id="rblBillState_2" type="radio" name="rblBillState" value="2" onclick="return rblBillState_onclick(2)" />

How should I create this scrpt. I've seen something 'bout the Control.Atributtes.AddAtributes, but that method would only add the bold text to the RadioButtonList, which is rendered as a table (not very usefull).

Thanks in advance...
 
S

Steven Cheng[MSFT]

Hi ,

Thanks for your posting. As for the adding clientside handler for
radiobuttons in RadioButtonList control problem, I think since the
RadioButtonList control has encapsulated its sub RadioButtons ,we can't
directly access them from the List , also I've checked that the ListItem in
the RadioButtonList.Items collectoin have some limitation on setting
attributes, see the following kb:

#The Attributes property of a ListItem control only works within an
HtmlSelect control
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q309338

Currently, I think we may need to use multi RadioButton or
HtmlInputRadioButton controls to replace the RadioButtonList control so as
to set the clientside eventhandler for them individually. Also , if you
have any concerns on this, please feel free to post here and we'll try
looking for some other workarounds. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
T

Tiësto

Hi Steven! thanks for answering, and for the time you took for posting such
a clear message.

I guess the best approach would be adding RadioButtons instead of a
RadiobuttonLIst, due to the non-databinding kind of situation. But one of
my co-workers told me to put the RadioButtonList inside a DIV tag, which in
turn receives the event, because of the bubbled events nature. Though I had
to write a function to get the selected item and compare it with the
previously selected item, It actually worked, and I could do what I wanted
to do. Next time I will consider your answer and will implement it directly.

Thank you.
 
S

Steven Cheng[MSFT]

Hi ,

Thanks for your followup. Glad that you've also found some other means to
get it work. Anyway, if you meet any further problems later, please also
feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top