Click here to Skip to main content
15,915,086 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
In my gridview i have one radiobuttonlist and textbox.
I want to enabled textbox only when "Yes" listitem was selected from radiobuttonlist.
I tried many ways (javascript, code behind) but nothing works. Please help.
Thanks in Advance.
Posted

This is not tested but you can try this

C#
$('input:radio[name=name_of_radio_button]').click(function() {
  if($('input:radio[name=name_of_radio_button]:checked').val() == "yes")
  {
   $(this).closest($(input:texbox)).attr("disabled", true);
  }
});
 
Share this answer
 
Hi,

First make autopostback = "True" other wise your selectedindexchange will not fire.
 
Share this answer
 
Comments
Rohit.Net100 3-Jun-11 10:26am    
THANKS
in radiobutton selectedindexchange

if(radiobuttonlist1.SelectedItem=="Yes")
{
// Write your code
}

But before that make autopostback="True" other wise your selectedindexchange will not fire.
 
Share this answer
 
Comments
Rohit.Net100 3-Jun-11 10:27am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900