Click here to Skip to main content
15,845,742 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 3 radio button list and a text box.
i want to select value from each radio button list and show the value in textbox.
Posted
Comments
Raja Soosai 25-May-12 5:57am    
What is your problem to show it?
DaveAuld 25-May-12 6:00am    
Do you mean you have 3 groups of Radio Buttons, and you want to populate a text box based on the selected radio from each group?

C#
foreach(RadioButton Rb in radiobtnlist.Controls.OfType<RadioButton>())
{

   if(Rb.Checked)
   {

    textBox1.Text = Rb.Text;

   }

}
 
Share this answer
 
v3
hey,

R u looking for this....
C#
textbox1.text= radiobuttonlist.selectedvalue.tostring()
 
Share this answer
 
v2
If you are trying to do this in Javascript. You can use the following code :

C#
var rblSelectType = document.getElementById('hdnRbtnList').value;
txtSelectedItem = document.getElementById('hdntxtTextbox').value;
var rbtnOne = rblSelectType + '_0';
var rbtnTwo = rblSelectType + '_1';
var rbtnThree = rblSelectType + '_3';
if (document.getElementById(rbtnOne).checked) {
    txtSelectedItem.value = "Your Value";
}
else if (document.getElementById(rbtnTwo).checked) {
    txtSelectedItem.value = "Your Value";
}
else if (document.getElementById(rbtnThree).checked) {
    txtSelectedItem.value = "Your Value";
}


hdnRbtnList - will be your RadiobuttonList ClientID
hdntxtTextbox - will be your TextBox ClientID

Hope this helps.
 
Share this answer
 

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