Powered by Blogger.

Sunday, July 18, 2010

Getting selected value from asp:RadioButtonList in JavaScript

HTML Code

In following code I am getting asp:RadioButtonList and populating 3 ListItems. Then I have a button and I am calling a JavaScript function when it is clicked.



JavaScript Code

In following code, I am getting the radio button element looping through its length. Checking each radiobutton for its checked value by accessing thorugh its index. As I am using RadioButtonList and I have 3 ListItem so I will collection of RadioButtons that lets me get each one of them by its index. If the radio[j].checked is true and I am giving value into an alert box.
 I hope this small article help someone in need :) Happy Coding !!

No comments:

Post a Comment

  ©Template by Dicas Blogger.

TOPO