12 Answers, 1 is accepted
0
Accepted
Hi neha,
Thank you for writing.
For detailed information on how to bind RadGridView to a DataTable, please refer to the following help article.
Then, in order to make one of its columns GridViewMultiComboBoxColumn you should:
In case you need to bind this GridViewMultiComboBoxColumn, please refer to this help article.
Best wishes,
Stefan
the Telerik team
Thank you for writing.
For detailed information on how to bind RadGridView to a DataTable, please refer to the following help article.
Then, in order to make one of its columns GridViewMultiComboBoxColumn you should:
- remove the column that you want to change
- add a new GridViewMultiComboBoxColumn
- set the new GridViewMultiComboBoxColumn.FieldName to the FieldName value of the removed column (which will restore the data mapping and fill it with data)
Refer to the next snippet for a code representation of the above explanation:
radGridView1.Columns.Remove("CategoryName");
GridViewMultiComboBoxColumn column = new GridViewMultiComboBoxColumn();
column.FieldName = "CategoryName";
radGridView1.Columns.Add(column);
In case you need to bind this GridViewMultiComboBoxColumn, please refer to this help article.
Best wishes,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Victoria F
Top achievements
Rank 1
answered on 19 Oct 2010, 10:13 PM
Hello guys ,
I have a question : how can I set a width of columns in GridViewMultiComboBoxColumn.
Now I have a GridVIew with GridViewMultiComboBoxColumn that when open DropDown shows 2 columns. Those columns have default width. I want to increase it.
Please , help.
Thank you,
Victoria.
I have a question : how can I set a width of columns in GridViewMultiComboBoxColumn.
Now I have a GridVIew with GridViewMultiComboBoxColumn that when open DropDown shows 2 columns. Those columns have default width. I want to increase it.
Please , help.
Thank you,
Victoria.
0
Hello Victoria F,
Thank you for your question.
In CellEditorInitialized event you can access the embedded RadGridView in RadMultiColumnComboBox editor and configure it to your needs. Please consider the following code:
I hope this helps. Let me know if you have any other questions.
Regards,
Martin Vasilev
the Telerik team
Thank you for your question.
In CellEditorInitialized event you can access the embedded RadGridView in RadMultiColumnComboBox editor and configure it to your needs. Please consider the following code:
void
radGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
RadMultiColumnComboBoxElement multiComboElement =
this
.radGridView1.ActiveEditor
as
RadMultiColumnComboBoxElement;
if
(multiComboElement !=
null
)
{
multiComboElement.EditorControl.Columns[0].Width = 200;
}
}
I hope this helps. Let me know if you have any other questions.
Regards,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Victoria F
Top achievements
Rank 1
answered on 18 Nov 2010, 12:07 AM
Hello Stefan ,
Lets see If column "CategoryName" is the first column ,
So , first I'm writing :
after this line goes code:
the new column appears at the end , so I have to move it at the right place:
But what happened with retrieved values of this column?
The column is empty.
So do I have to loop through and copy all the values from the removed column and assign them to the new one or there is a solution that all originally retrieved values are reflected in a new MultiComboBoxColumn?
Thank you ,
Victoria.
Lets see If column "CategoryName" is the first column ,
So , first I'm writing :
radGridView1.DataSource = dtDataTable;
after this line goes code:
radGridView1.Columns.Remove("CategoryName");
GridViewMultiComboBoxColumn column = new GridViewMultiComboBoxColumn();
column.FieldName = "CategoryName";
radGridView1.Columns.Add(column);
radGridView1.Columns.Move(radGridView1.Columns.Count - 1, 0);
The column is empty.
So do I have to loop through and copy all the values from the removed column and assign them to the new one or there is a solution that all originally retrieved values are reflected in a new MultiComboBoxColumn?
Thank you ,
Victoria.
0
Hello Victoria F,
Thank you for getting back to us.
You can achieve the described requirement using the Insert method when adding the new column:
Please give it a try and let me know if you still experience any issues.
Best wishes,
Martin Vasilev
the Telerik team
Thank you for getting back to us.
You can achieve the described requirement using the Insert method when adding the new column:
GridViewMultiComboBoxColumn column =
new
GridViewMultiComboBoxColumn();
column.FieldName =
"CategoryName"
;
radGridView1.Columns.Insert(0, column);
Please give it a try and let me know if you still experience any issues.
Best wishes,
Martin Vasilev
the Telerik team
0

Victoria F
Top achievements
Rank 1
answered on 22 Nov 2010, 06:22 PM
Thank you Martin,
It's really works and inserts the column in the right place. But it still has the same problem with values.
The column in the gridview is empty. All other columns are populated from the datasource exept this one...
Please , see the picture attached...
The values are in the GridViewMultiComboBoxColumn. So when I open dropdown box the values are there.
In debugger I see that the column #3 HAS values, but why those values are not displayed in the gridview?
Thank you,
Victoria.
It's really works and inserts the column in the right place. But it still has the same problem with values.
The column in the gridview is empty. All other columns are populated from the datasource exept this one...
Please , see the picture attached...
The values are in the GridViewMultiComboBoxColumn. So when I open dropdown box the values are there.
In debugger I see that the column #3 HAS values, but why those values are not displayed in the gridview?
radGridView1
.Rows[i].Cells[3].Value = "PO_1", but on the screen it's empty...?????
Thank you,
Victoria.
0

Richard Slade
Top achievements
Rank 2
answered on 22 Nov 2010, 10:35 PM
Hello Victoria,
I have tried this out and have everything working fine in a very simple exmaple.
1: I have bound a radGridView to a simple list based datasource that contains an Id column, plus a few others
2: I have removed that column
3: Then added in a GridViewmultiComboBoxColumn, specifying a new datasource for it, along with a DisplayMember and ValueMember
4: I then moved this column to the first column index in the RadGridView.
I think this is what you are trying to achieve here. is that correct?
If so, please try this sample and let me know if that works for you.
using
Telerik.WinControls;
using
Telerik.WinControls.UI;
using
Telerik.WinControls.Data;
using
Telerik.WinControls.UI.Grid;
public
class
Form1
{
private
void
Form1_Load(System.Object sender, System.EventArgs e)
{
// Make a data source for the grid
List<person> list =
new
List<person>();
list.Add(
new
person(
"Richard"
, 1,
"New Milton"
));
list.Add(
new
person(
"Bob"
, 2,
"London"
));
list.Add(
new
person(
"Stewart"
, 3,
"Bournemouth"
));
list.Add(
new
person(
"Chris"
, 4,
"Southampton"
));
list.Add(
new
person(
"Leisl"
, 1,
"Christcurch"
));
list.Add(
new
person(
"Tom"
, 5,
"Weymouth"
));
list.Add(
new
person(
"Oly"
, 6,
null
));
// assign the data source of the grid
this
.RadGridView1.DataSource = list;
// Make a data source for the multi column combo
List<Customer> customers =
new
List<Customer>();
customers.Add(
new
Customer(1,
"Customer 1"
));
customers.Add(
new
Customer(2,
"Customer 2"
));
customers.Add(
new
Customer(3,
"Customer 3"
));
customers.Add(
new
Customer(4,
"Customer 4"
));
customers.Add(
new
Customer(5,
"Customer 5"
));
customers.Add(
new
Customer(6,
"Customer 6"
));
customers.Add(
new
Customer(7,
"Customer 7"
));
// remove the bound id column
this
.RadGridView1.Columns.Remove(
"Id"
);
// Make a new multi combo column
GridViewMultiComboBoxColumn column =
new
GridViewMultiComboBoxColumn();
column.FieldName =
"Id"
;
column.DataSource = customers;
column.DisplayMember =
"Id"
;
column.ValueMember =
"Id"
;
// Add the new column back in
this
.RadGridView1.Columns.Add(column);
// move it to the start
this
.RadGridView1.Columns.Move(RadGridView1.Columns.Count - 1, 0);
}
}
public
class
Customer
{
private
int
m_CustomerId;
private
string
m_ContactName;
public
Customer(
int
id,
string
name)
{
m_ContactName = name;
m_CustomerId = id;
}
public
string
Name {
get
{
return
m_ContactName; }
}
public
int
Id {
get
{
return
m_CustomerId; }
}
}
public
class
person
{
private
int
m_Customer_Id;
private
string
m_Name;
private
string
m_City;
public
person()
{
}
public
person(
string
name,
int
id,
string
city)
{
m_Name = name;
m_Customer_Id = id;
m_City = city;
}
public
string
City {
get
{
return
m_City; }
set
{ m_City = value; }
}
public
string
Name {
get
{
return
m_Name; }
set
{ m_Name = value; }
}
public
int
Id {
get
{
return
m_Customer_Id; }
set
{ m_Customer_Id = value; }
}
}
and in it's original VB form
Imports
Telerik.WinControls
Imports
Telerik.WinControls.UI
Imports
Telerik.WinControls.Data
Imports
Telerik.WinControls.UI.Grid
Public
Class
Form1
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
' Make a data source for the grid
Dim
list
As
New
List(Of person)
list.Add(
New
person(
"Richard"
, 1,
"New Milton"
))
list.Add(
New
person(
"Bob"
, 2,
"London"
))
list.Add(
New
person(
"Stewart"
, 3,
"Bournemouth"
))
list.Add(
New
person(
"Chris"
, 4,
"Southampton"
))
list.Add(
New
person(
"Leisl"
, 1,
"Christcurch"
))
list.Add(
New
person(
"Tom"
, 5,
"Weymouth"
))
list.Add(
New
person(
"Oly"
, 6,
Nothing
))
' assign the data source of the grid
Me
.RadGridView1.DataSource = list
' Make a data source for the multi column combo
Dim
customers
As
New
List(Of Customer)
customers.Add(
New
Customer(1,
"Customer 1"
))
customers.Add(
New
Customer(2,
"Customer 2"
))
customers.Add(
New
Customer(3,
"Customer 3"
))
customers.Add(
New
Customer(4,
"Customer 4"
))
customers.Add(
New
Customer(5,
"Customer 5"
))
customers.Add(
New
Customer(6,
"Customer 6"
))
customers.Add(
New
Customer(7,
"Customer 7"
))
' remove the bound id column
Me
.RadGridView1.Columns.Remove(
"Id"
)
' Make a new multi combo column
Dim
column
As
New
GridViewMultiComboBoxColumn()
column.FieldName =
"Id"
column.DataSource = customers
column.DisplayMember =
"Id"
column.ValueMember =
"Id"
' Add the new column back in
Me
.RadGridView1.Columns.Add(column)
' move it to the start
Me
.RadGridView1.Columns.Move(RadGridView1.Columns.Count - 1, 0)
End
Sub
End
Class
Public
Class
Customer
Private
m_CustomerId
As
Integer
Private
m_ContactName
As
String
Public
Sub
New
(
ByVal
id
As
Integer
,
ByVal
name
As
String
)
m_ContactName = name
m_CustomerId = id
End
Sub
Public
ReadOnly
Property
Name()
As
String
Get
Return
m_ContactName
End
Get
End
Property
Public
ReadOnly
Property
Id()
As
Integer
Get
Return
m_CustomerId
End
Get
End
Property
End
Class
Public
Class
person
Private
m_Customer_Id
As
Integer
Private
m_Name
As
String
Private
m_City
As
String
Public
Sub
New
()
End
Sub
Public
Sub
New
(
ByVal
name
As
String
,
ByVal
id
As
Integer
,
ByVal
city
As
String
)
m_Name = name
m_Customer_Id = id
m_City = city
End
Sub
Public
Property
City()
As
String
Get
Return
m_City
End
Get
Set
(
ByVal
value
As
String
)
m_City = value
End
Set
End
Property
Public
Property
Name()
As
String
Get
Return
m_Name
End
Get
Set
(
ByVal
value
As
String
)
m_Name = value
End
Set
End
Property
Public
Property
Id()
As
Integer
Get
Return
m_Customer_Id
End
Get
Set
(
ByVal
value
As
Integer
)
m_Customer_Id = value
End
Set
End
Property
End
Class
regards,
Richard
0

Victoria F
Top achievements
Rank 1
answered on 22 Nov 2010, 11:38 PM
Richard ,
I beleive this is a bug of the control..
I added to your code only this little piece
:
I beleive this is a bug of the control..
I added to your code only this little piece
- I created 2 datatable that have the same structure as your lists.
- I fill those datatables with the values from your lists.
- I assign as a DataSource for the main GridView and Dropdown column my new DataTables.
- I get EMPTY column !!!!!!! See the picture.
- I'll attach the full code..
// those lines are DataTables that have the same structure as your lists
DataTable dtList =
new
WindowsFormsApplication1.DataSet1.dt_ListDataTable();
DataTable dtCustomers =
new
WindowsFormsApplication1.DataSet1.dt_CustomersDataTable();
//here I filled DataTables with values see the picture attached
for
(
int
i = 0; i < list.Count; i++)
{
DataRow dr = dtList.NewRow();
dr[0] = list[i].Name;
dr[1] = list[i].Id;
dr[2] = list[i].City;
dtList.Rows.Add(dr);
}
// Here DataSource is a DataTable !!!!!!!!!!!!!!!!!!!!!
this
.radGridView1.DataSource = dtList;
for
(
int
i = 0; i < customers.Count; i++)
{
DataRow dr = dtCustomers.NewRow();
dr[0] = customers[i].Name;
dr[1] = customers[i].Id;
dtCustomers.Rows.Add(dr);
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
// Make a data source for the grid
List<person> list =
new
List<person>();
list.Add(
new
person(
"Richard"
, 1,
"New Milton"
));
list.Add(
new
person(
"Bob"
, 2,
"London"
));
list.Add(
new
person(
"Stewart"
, 3,
"Bournemouth"
));
list.Add(
new
person(
"Chris"
, 4,
"Southampton"
));
list.Add(
new
person(
"Leisl"
, 1,
"Christcurch"
));
list.Add(
new
person(
"Tom"
, 5,
"Weymouth"
));
list.Add(
new
person(
"Oly"
, 6,
null
));
// assign the data source of the grid
//!!!!!! this line I commented out !!!!!!!
//this.radGridView1.DataSource = list;
// Make a data source for the multi column combo
List<Customer> customers =
new
List<Customer>();
customers.Add(
new
Customer(1,
"Customer 1"
));
customers.Add(
new
Customer(2,
"Customer 2"
));
customers.Add(
new
Customer(3,
"Customer 3"
));
customers.Add(
new
Customer(4,
"Customer 4"
));
customers.Add(
new
Customer(5,
"Customer 5"
));
customers.Add(
new
Customer(6,
"Customer 6"
));
customers.Add(
new
Customer(7,
"Customer 7"
));
// those lines are DataTables that have the same structure as your lists
DataTable dtList =
new
WindowsFormsApplication1.DataSet1.dt_ListDataTable();
DataTable dtCustomers =
new
WindowsFormsApplication1.DataSet1.dt_CustomersDataTable();
//here I filled DataTables with values see the picture attached
for
(
int
i = 0; i < list.Count; i++)
{
DataRow dr = dtList.NewRow();
dr[0] = list[i].Name;
dr[1] = list[i].Id;
dr[2] = list[i].City;
dtList.Rows.Add(dr);
}
// Here DataSource is a DataTable !!!!!!!!!!!!!!!!!!!!!
this
.radGridView1.DataSource = dtList;
for
(
int
i = 0; i < customers.Count; i++)
{
DataRow dr = dtCustomers.NewRow();
dr[0] = customers[i].Name;
dr[1] = customers[i].Id;
dtCustomers.Rows.Add(dr);
}
// remove the bound id column
this
.radGridView1.Columns.Remove(
"Customer_ID"
);
// Make a new multi combo column
GridViewMultiComboBoxColumn column =
new
GridViewMultiComboBoxColumn();
column.FieldName =
"Id"
;
column.DataSource = customers;
//column.DataSource = dtCustomers;
column.DisplayMember =
"Id"
;
column.ValueMember =
"Id"
;
// Add the new column back in
this
.radGridView1.Columns.Insert(0, column);
// move it to the start
//this.radGridView1.Columns.Move(radGridView1.Columns.Count - 1, 0);
}
0

Richard Slade
Top achievements
Rank 2
answered on 23 Nov 2010, 12:17 AM
Hello Victoria,
I have this working, but had to change around the order of the columns as they are described in the code for the data table.
Please have a look at this example (+ screenshot) and let me know if this works for you too.
Regards,
Richard
I have this working, but had to change around the order of the columns as they are described in the code for the data table.
Please have a look at this example (+ screenshot) and let me know if this works for you too.
using
Telerik.WinControls;
using
Telerik.WinControls.UI;
using
Telerik.WinControls.Data;
using
Telerik.WinControls.UI.Grid;
public
class
Form1
{
private
void
Form1_Load(System.Object sender, System.EventArgs e)
{
// Make a data source for the grid
List<person> list =
new
List<person>();
list.Add(
new
person(
"Richard"
, 1,
"New Milton"
));
list.Add(
new
person(
"Bob"
, 2,
"London"
));
list.Add(
new
person(
"Stewart"
, 3,
"Bournemouth"
));
list.Add(
new
person(
"Chris"
, 4,
"Southampton"
));
list.Add(
new
person(
"Leisl"
, 1,
"Christcurch"
));
list.Add(
new
person(
"Tom"
, 5,
"Weymouth"
));
list.Add(
new
person(
"Oly"
, 6,
null
));
// assign the data source of the grid
this
.RadGridView1.DataSource = list;
// Make a data source for the multi column combo
List<Customer> customers =
new
List<Customer>();
customers.Add(
new
Customer(1,
"Customer 1"
));
customers.Add(
new
Customer(2,
"Customer 2"
));
customers.Add(
new
Customer(3,
"Customer 3"
));
customers.Add(
new
Customer(4,
"Customer 4"
));
customers.Add(
new
Customer(5,
"Customer 5"
));
customers.Add(
new
Customer(6,
"Customer 6"
));
customers.Add(
new
Customer(7,
"Customer 7"
));
// those lines are DataTables that have the same structure as your lists
DataTable dtList =
new
DataSet1.dt_ListDataTable();
DataTable dtCustomers =
new
DataSet1.dt_CustomersDataTable();
//here I filled DataTables with values see the picture attached
for
(
int
i = 0; i <= list.Count - 1; i++) {
DataRow dr = dtList.NewRow();
dr(0) = list(i).City;
dr(1) = list(i).Name;
dr(2) = list(i).Id;
dtList.Rows.Add(dr);
}
// Here DataSource is a DataTable !!!!!!!!!!!!!!!!!!!!!
this
.RadGridView1.DataSource = dtList;
for
(
int
i = 0; i <= customers.Count - 1; i++) {
DataRow dr = dtCustomers.NewRow();
dr(0) = customers(i).Id;
dr(1) = customers(i).Name;
dtCustomers.Rows.Add(dr);
}
// remove the bound id column
this
.RadGridView1.Columns.Remove(
"Id"
);
// Make a new multi combo column
GridViewMultiComboBoxColumn column =
new
GridViewMultiComboBoxColumn();
column.FieldName =
"Id"
;
column.DataSource = dtCustomers;
column.DisplayMember =
"Id"
;
column.ValueMember =
"Id"
;
// Add the new column back in
this
.RadGridView1.Columns.Add(column);
// move it to the start
this
.RadGridView1.Columns.Move(RadGridView1.Columns.Count - 1, 0);
}
}
public
class
Customer
{
private
int
m_CustomerId;
private
string
m_ContactName;
public
Customer(
int
id,
string
name)
{
m_ContactName = name;
m_CustomerId = id;
}
public
string
Name {
get
{
return
m_ContactName; }
}
public
int
Id {
get
{
return
m_CustomerId; }
}
}
public
class
person
{
private
int
m_Customer_Id;
private
string
m_Name;
private
string
m_City;
public
person()
{
}
public
person(
string
name,
int
id,
string
city)
{
m_Name = name;
m_Customer_Id = id;
m_City = city;
}
public
string
City {
get
{
return
m_City; }
set
{ m_City = value; }
}
public
string
Name {
get
{
return
m_Name; }
set
{ m_Name = value; }
}
public
int
Id {
get
{
return
m_Customer_Id; }
set
{ m_Customer_Id = value; }
}
}
Regards,
Richard
0

Victoria F
Top achievements
Rank 1
answered on 23 Nov 2010, 12:37 AM
Thank you ,
Richard .
Yes this start working. As I understand it will work only if ID column will be the last column. (Or any drop down box column must be the LAST column)
If I need a couple of those drop down columns?? What suppose to be an order in this case ?
So when you remove or add this column at the end it pick up it's values..?
Is this a bug or a feature? Could it be fixed later to be used in any order just by column name?
Thank you for your help,
Victoria.
Richard .
Yes this start working. As I understand it will work only if ID column will be the last column. (Or any drop down box column must be the LAST column)
If I need a couple of those drop down columns?? What suppose to be an order in this case ?
So when you remove or add this column at the end it pick up it's values..?
Is this a bug or a feature? Could it be fixed later to be used in any order just by column name?
Thank you for your help,
Victoria.
0

Richard Slade
Top achievements
Rank 2
answered on 23 Nov 2010, 11:06 AM
Hello again Victoria,
I don't see any issue here. I have extended the sample above to include a second multicolumncombo and all is working fine. Please have a go with the code below.
Richard
I don't see any issue here. I have extended the sample above to include a second multicolumncombo and all is working fine. Please have a go with the code below.
using
Telerik.WinControls;
using
Telerik.WinControls.UI;
using
Telerik.WinControls.Data;
using
Telerik.WinControls.UI.Grid;
public
class
Form1
{
private
void
Form1_Load(System.Object sender, System.EventArgs e)
{
// Make a data source for the grid
List<person> list =
new
List<person>();
list.Add(
new
person(
"Richard"
, 1,
"New Milton"
));
list.Add(
new
person(
"Bob"
, 2,
"London"
));
list.Add(
new
person(
"Stewart"
, 3,
"Bournemouth"
));
list.Add(
new
person(
"Chris"
, 4,
"Southampton"
));
list.Add(
new
person(
"Leisl"
, 1,
"Christcurch"
));
list.Add(
new
person(
"Tom"
, 5,
"Weymouth"
));
list.Add(
new
person(
"Oly"
, 6,
null
));
// Make a data source for the Id multi column combo
List<Customer> customers =
new
List<Customer>();
customers.Add(
new
Customer(1,
"Customer 1"
));
customers.Add(
new
Customer(2,
"Customer 2"
));
customers.Add(
new
Customer(3,
"Customer 3"
));
customers.Add(
new
Customer(4,
"Customer 4"
));
customers.Add(
new
Customer(5,
"Customer 5"
));
customers.Add(
new
Customer(6,
"Customer 6"
));
customers.Add(
new
Customer(7,
"Customer 7"
));
// Make a data source for the City multi column combo
List<City> cities =
new
List<City>();
cities.Add(
new
City(
"New Milton"
));
cities.Add(
new
City(
"London"
));
cities.Add(
new
City(
"Bournemouth"
));
cities.Add(
new
City(
"Southampton"
));
cities.Add(
new
City(
"Christcurch"
));
cities.Add(
new
City(
"Weymouth"
));
cities.Add(
new
City(
"Highcliffe"
));
// those lines are DataTables that have the same structure as your lists
DataTable dtList =
new
DataSet1.dt_ListDataTable();
DataTable dtCustomers =
new
DataSet1.dt_CustomersDataTable();
DataTable dtCity =
new
DataSet1.dt_CityDataTable();
//here I filled DataTables with values see the picture attached
for
(
int
i = 0; i <= list.Count - 1; i++) {
DataRow dr = dtList.NewRow();
dr(0) = list(i).City;
dr(1) = list(i).Id;
dr(2) = list(i).Name;
dtList.Rows.Add(dr);
}
// Here DataSource is a DataTable !!!!!!!!!!!!!!!!!!!!!
this
.RadGridView1.DataSource = dtList;
for
(
int
i = 0; i <= customers.Count - 1; i++) {
DataRow dr = dtCustomers.NewRow();
dr(0) = customers(i).Id;
dr(1) = customers(i).Name;
dtCustomers.Rows.Add(dr);
}
for
(
int
i = 0; i <= cities.Count - 1; i++) {
DataRow dr = dtCity.NewRow();
dr(0) = cities(i).CityName;
dtCity.Rows.Add(dr);
}
// remove the bound id column
this
.RadGridView1.Columns.Remove(
"Id"
);
// Make a new multi combo column
GridViewMultiComboBoxColumn column =
new
GridViewMultiComboBoxColumn();
column.FieldName =
"Id"
;
column.DataSource = dtCustomers;
column.DisplayMember =
"Id"
;
column.ValueMember =
"Id"
;
// Add the new column back in
this
.RadGridView1.Columns.Add(column);
// remove the bound city column
this
.RadGridView1.Columns.Remove(
"City"
);
// Make a new multi combo column
GridViewMultiComboBoxColumn column2 =
new
GridViewMultiComboBoxColumn();
column2.FieldName =
"City"
;
column2.DataSource = dtCity;
column2.DisplayMember =
"CityName"
;
column2.ValueMember =
"CityName"
;
// Add the new column back in
this
.RadGridView1.Columns.Add(column2);
// move it to the start
//Me.RadGridView1.Columns.Move(RadGridView1.Columns.Count - 1, 0)
}
}
public
class
City
{
private
string
m_CityName;
public
City(
string
city)
{
m_CityName = city;
}
public
string
CityName {
get
{
return
m_CityName; }
}
}
public
class
Customer
{
private
int
m_CustomerId;
private
string
m_ContactName;
public
Customer(
int
id,
string
name)
{
m_ContactName = name;
m_CustomerId = id;
}
public
string
Name {
get
{
return
m_ContactName; }
}
public
int
Id {
get
{
return
m_CustomerId; }
}
}
public
class
person
{
private
int
m_Customer_Id;
private
string
m_Name;
private
string
m_City;
public
person()
{
}
public
person(
string
name,
int
id,
string
city)
{
m_Name = name;
m_Customer_Id = id;
m_City = city;
}
public
string
City {
get
{
return
m_City; }
set
{ m_City = value; }
}
public
string
Name {
get
{
return
m_Name; }
set
{ m_Name = value; }
}
public
int
Id {
get
{
return
m_Customer_Id; }
set
{ m_Customer_Id = value; }
}
}
0

Victoria F
Top achievements
Rank 1
answered on 24 Nov 2010, 07:18 PM
Thank you,
It's working.
Victoria.
It's working.
Victoria.