Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column of radiobuttons in a datagrid

Status
Not open for further replies.

RebLazer

Programmer
Jun 7, 2002
438
US
I have a datagrid with two bound columns and I need to add a column containing a pair of radiobuttons per row. Is there an easy way to do that using VS.net, or must I code it to dynamically generate the radiobuttons at databinding time?

Thanks!
Lazer [pipe]
 
I realized that I need a RadioButtonList, which I addded to a template column in my datagrid. This is what I currently have for a binding subroutine:

Private Sub grants_datagrid_bind()
disp_grants_org_lbl.Text = candidate_orgs.SelectedItem.Text
'disp_grants_org_lbl.Text = selected_org_nm 'WHY DOESN'T THIS WORK???

disp_grants_pi_lbl.Text = selected_pi_nm
disp_grants_page()
Dim strConn As String = ConfigurationSettings.AppSettings("ConnectstrW")
Dim conn As New SqlConnection(strConn)
Dim myCommand As New SqlDataAdapter("[dbo].get_grants_for_pi", strConn)
Dim workParam As New SqlParameter()
Dim mydad As New SqlDataAdapter()
mydad.SelectCommand = New SqlCommand("[dbo].get_grants_for_pi", conn)
mydad.SelectCommand.CommandType = CommandType.StoredProcedure
mydad.SelectCommand.Parameters.Add("@pi_id", SqlDbType.VarChar).Value = selected_pi_id
Dim ds As New DataSet()

mydad.Fill(ds)
disp_grants_dg.DataSource = ds
disp_grants_dg.DataBind()

disp_grants_org_lbl.Width = disp_grants_dg.Width()

End Sub


So now that I already have all of that data floating around this subroutine - how do I set the appropriate radioButton in each approprate row? The names of the buttons are oligo_grant_yes and oligo_grant_no. The name of the database field with either a "Y" or "N" value is oligo_user.

Thanks so much!
Lazer
 
Problem solved.

All this took was creating a template column in the datagrid and adding in the radiobuttons to it.

Lazer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top