Click here to Skip to main content
15,888,037 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to bind a column value from datagridview to radiobutton in winforms using C#.net?
Posted
Comments
BobJanova 15-Apr-11 9:02am    
What do you mean? A radio button on its own is not much use. A radio button group can represent one value (a ranged int or enum, essentially), whereas a data grid column is a collection of values.

Also, have you considered a dropdown cell type? That should allow the user to pick one from a list without the other controls.

You would not directly data bind from one control to another, instead they would both be bound to a business layer object (or ModelView in Silverlight/WPF terms) which would expose the appropriate properties for the radio buttons.

I think you want to set the value for radio button based on the selection in the gridview
this can be done by

GridViewRow row = GridView1.SelectedRow;
TextBox2.Text = row.Cells[2].Text;
if(TextBox2.Text=="Something")
rdobtn.value=true;
else
rdobtn.value=false;
 
Share this answer
 
v2
Comments
nsavithal.darsipudi 15-Apr-11 7:17am    
ur suggested code is for textbox but i want to bind to radiobutton control
Sridhar Patnayak 15-Apr-11 7:27am    
you want to set true or false for radio button,so what I am doing is I am getting the selected row from gridview, and based on the condition i am binding it to radiobutton.
nsavithal.darsipudi 15-Apr-11 8:12am    
why did u take textbox?
Sridhar Patnayak 15-Apr-11 8:18am    
for better understanding
Israr Zaib 16-Mar-13 0:09am    
Sir Srinder Patnayak please bind radio button to datagridview
 
Share this answer
 
Comments
Israr Zaib 16-Mar-13 0:06am    
hi i don't understand how to bind radio button to datagridview
just like in this formate:
textbox1.databindings.add("text",datasetname,"tablename.fieldname")
please tell me in this formate (in VB.NET)

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