0

Hi people

I have radio button list populated from database. By default first value is selected. How can i call JavaScript function if user selects another value in radio button list.

2
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by jbisono
0

You can try this, is the first thing comes to my mind, in your Page_Load Method do this.

foreach(ListItem li in RadioButtonList1.Items)
{
   li.Attributes.Add("onClick", "CheckChange('" + li.Text + "','" + li.Value + "')");
}

Then just create a javascript function called CheckChange, li.text and li.value are parameters

Hope that helps!!!

0

Its still not calling function :( dun know why
kindly help me out...
its being two days that i m stuck here

0

Oh it works

I was so frustrated that i place your code before populating RadioButtonList

Very good piece of code.

Thank you jbisono

Cheers happy coding

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.