This is a migrated thread and some comments may be shown as answers.

Question on Gridview

2 Answers 63 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 09 Nov 2007, 02:03 AM
I want to create a gridview, populate it from a SQL database, but have the first column as a combobox, and the second column an editable textbox.  Can someone point me to some code where this exist?

2 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 09 Nov 2007, 02:17 AM
Thank you for letting me post.  I went into the wizard and selected the types of controls.  My problem is that I am programming in VB 6 and .Net 2005, and for one second I became brain dead.

Holla at ur boyee if this happens to you
0
Jack
Telerik team
answered on 09 Nov 2007, 01:09 PM
Hello David,

Thank you for this question. We will be glad to help you.

To create a grid containing ComboBox and TextBox columns, follow these steps:

  1. Disable the automatic generation of columns through the AutoGenerateColumns property of the GridViewTemplate class.
  2. Create and initialize an instance of the GridViewComboBoxColumn class
  3. Create and initialize an instance of the GridViewTextBoxColumn class
  4. Add these columns to the Columns collection of the RadGridView
  5. Bind the grid to your data souce
Refer to the following code snipped:

Dim table As New DataTable() 
table.Columns.Add("Combo"
table.Columns.Add("TextBox"
 
table.Rows.Add("A", 1) 
table.Rows.Add("B", 2) 
table.Rows.Add("C", 3) 
table.Rows.Add("B", 4) 
 
Me.radGridView1.MasterGridViewTemplate.AutoGenerateColumns = False 
 
Dim comboColumn As New GridViewComboBoxColumn("Combo"
comboColumn.DataSource = New String() {"A""B""C"
 
Me.radGridView1.Columns.Add(comboColumn) 
Me.radGridView1.Columns.Add(New GridViewTextBoxColumn("TextBox")) 
 
Me.radGridView1.DataSource = table 

For our information on Clumn Types you can review the examples, provided with the installation.

 
Kind regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Jack
Telerik team
Share this question
or