Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How do I get the SelectedValue from a RadioButtonList using javascript

Reply
Thread Tools

How do I get the SelectedValue from a RadioButtonList using javascript

 
 
pierre@globalkinetic.net
Guest
Posts: n/a
 
      03-29-2005
Can anyone tell me how to get the SelectedValue from a ASP.net
RadioButtonList, using javavscript.

Here is my code:

<ASP:RADIOBUTTONLIST id="optOption" runat="server"
ONCLICK="javascript:alert(docu*ment.all.optOption. selectedIte*m);"></ASP:RADIOBUTTONLIST>


This is not working. I am getting an error saying that
'document.all.optOption.select*edItem is null or not an object'.

Thanks in advance,
Pierre

 
Reply With Quote
 
 
 
 
nandha
Guest
Posts: n/a
 
      03-29-2005
Hi,

Please remove inline javascript code.
<ASP:RADIOBUTTONLIST id="optOption"
runat="server"></ASP:RADIOBUTTONLIST>

Add the following code in the code behind file.

Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

optOption.Attributes.Add("OnClick", "alert(" &
optOption.ClientID.ToString & ".value)")
End Sub

Regards,
nandha.


>-----Original Message-----
>Can anyone tell me how to get the SelectedValue from a

ASP.net
>RadioButtonList, using javavscript.
>
>Here is my code:
>
><ASP:RADIOBUTTONLIST id="optOption" runat="server"
>ONCLICK="javascript:alert(docu*

ment.all.optOption.selectedIte*m);"></ASP:RADIOBUTTONLIST>
>
>
>This is not working. I am getting an error saying that
>'document.all.optOption.select*edItem is null or not an

object'.
>
>Thanks in advance,
>Pierre
>
>.
>

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how to get selectedvalue of radiobuttonlist in Javascript? Arnold ASP .Net Web Controls 6 11-12-2006 05:36 PM
how to get selectedvalue of radiobuttonlist in Javascript? Arnold ASP .Net Datagrid Control 4 11-12-2006 03:24 PM
RadioButtonList SelectedValue thinkmast ASP .Net 0 05-07-2006 08:21 PM
Getting SelectedValue from RadioButtonList using javascript pierre@globalkinetic.net ASP .Net Web Controls 0 03-11-2005 11:05 AM



Advertisments