
Victoria F
Top achievements
Rank 1
Victoria F
asked on 20 Oct 2010, 03:04 PM
Please , help me to set a size of the columns in GridViewMultiComboBoxColumn of the GridView.
I'm trying to increase a width of the columns in dropdown combobox (see picture attached).
Thank you ,
Victoria.
I'm trying to increase a width of the columns in dropdown combobox (see picture attached).
Thank you ,
Victoria.
11 Answers, 1 is accepted
0

Richard Slade
Top achievements
Rank 2
answered on 20 Oct 2010, 04:16 PM
Hi Victoria,
You can set the BestFit on this or get to the columns directly. Have a look at this link
Let me know if you need other help
Richard
You can set the BestFit on this or get to the columns directly. Have a look at this link
Let me know if you need other help
Richard
0

Victoria F
Top achievements
Rank 1
answered on 20 Oct 2010, 04:20 PM
Thank you for the answer, but this is not what I need. I need not the columns of the GredView. I need to reach columns that are in the combobox which is a cell of the gridview. See the picture I attached before : dropdown(combobox) is one of the cells of the gridview, inside this dropdown(combobox) there are 2 columns, width of those 2 columns I can not set.
Thank you ,
Victoria.
Thank you ,
Victoria.
0

Richard Slade
Top achievements
Rank 2
answered on 20 Oct 2010, 04:23 PM
Hi Victoria,
The link was not referring to the GridView. It is referring to the GridViewMultiColumnBoxColumn as you asked. If I have misunderstood, my apologies.
Richard
The link was not referring to the GridView. It is referring to the GridViewMultiColumnBoxColumn as you asked. If I have misunderstood, my apologies.
Richard
0

Victoria F
Top achievements
Rank 1
answered on 20 Oct 2010, 04:28 PM
GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn();
col.DataSource = dtLobList;
col.DisplayMember = "LobText";
col.ValueMember = "LobText";
col.FieldName = "LobText";
col.Name = "LOB";
col.HeaderText = "LOB";
col.Width = 200;
dgv_format.Columns.Add(col);
col.Width = 200;
sets the size of the GridView column that is combobox..
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 20 Oct 2010, 04:29 PM
Hi,
This is partly lifted from the link..
Hope this helps
This is partly lifted from the link..
Hope this helps
Private isColumnAdded As Boolean
Private
Sub
radGridView1_CellBeginEdit(
ByVal
sender
As
Object
,
ByVal
e
As
GridViewCellCancelEventArgs)
If
TypeOf
Me
.GridView.CurrentColumn
Is
GridViewMultiComboBoxColumn
Then
If
(
Not
isColumnAdded)
Then
isColumnAdded =
True
Dim
editor
As
RadMultiColumnComboBoxElement =
CType
(
Me
.GridView.ActiveEditor, RadMultiColumnComboBoxElement)
editor.EditorControl.MasterGridViewTemplate.AutoGenerateColumns =
False
editor.EditorControl.Columns.Add(
New
GridViewTextBoxColumn(
"OrderID"
))
editor.EditorControl.Columns.Add(
New
GridViewTextBoxColumn(
"Quantity"
))
editor.AutoSizeDropDownToBestFit =
True
editor.EditorControl.Columns(0).Width = 50
End
If
End
If
End
Sub
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 20 Oct 2010, 04:54 PM
Victoria,
This is the part you will be especially interested in..
Let me know if that helps
Richard
This is the part you will be especially interested in..
Dim
editor
As
RadMultiColumnComboBoxElement =
CType
(
Me
.GridView.ActiveEditor, RadMultiColumnComboBoxElement)
editor.AutoSizeDropDownToBestFit =
True
editor.EditorControl.Columns(0).Width = 50
Richard
0

Victoria F
Top achievements
Rank 1
answered on 20 Oct 2010, 06:47 PM
Thank you , Richard
Yes, that's what I needed ,
Now , it works.
When I tried to assign width by columns, it does not see the columns. I assume because of datasource assigned as a DataTable:
GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn();
col.DataSource = dtLobList;
dgv_format.Columns.Add(col);
Anyway,
Thank you,
Victoria.
Yes, that's what I needed ,
private void radGridView_LayerList_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
if (this.radGridView_LayerList.ActiveEditor is RadMultiColumnComboBoxElement)
{
((RadGridView)((RadMultiColumnComboBoxElement)this.radGridView_LayerList.ActiveEditor).EditorControl).AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
}
When I tried to assign width by columns, it does not see the columns. I assume because of datasource assigned as a DataTable:
GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn();
col.DataSource = dtLobList;
dgv_format.Columns.Add(col);
Anyway,
AutoSizeColumnsMode
works forRadMultiColumnComboBoxElement
. Thank you,
Victoria.
0

Richard Slade
Top achievements
Rank 2
answered on 20 Oct 2010, 07:48 PM
Very glad you have it working Victoria.
Please remember to mark as answer so others can quickly find the solution too.
All the best
Richard
Please remember to mark as answer so others can quickly find the solution too.
All the best
Richard
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 20 Oct 2010, 07:59 PM
Hi again,
you can still get to the columns, it's just that it is auto generating them for you.
(will be something very close to this.. I don't have access to a development environment right now)
Hope that helps
Richard
you can still get to the columns, it's just that it is auto generating them for you.
private
void
radGridView_LayerList_CellBeginEdit(
object
sender, GridViewCellCancelEventArgs e)
{
if
(
this
.radGridView_LayerList.ActiveEditor
is
RadMultiColumnComboBoxElement)
{
((RadGridView)((RadMultiColumnComboBoxElement)
this
.radGridView_LayerList.ActiveEditor).EditorControl).Columns(0).Width = 50; }
}
(will be something very close to this.. I don't have access to a development environment right now)
Hope that helps
Richard
0

Diego Guayan
Top achievements
Rank 1
answered on 01 Dec 2010, 01:15 AM
I am having problem getting the columns as in given sample above.
My code as follows...
I always gets the error, column count = 0,
Am I missing something here?
My code as follows...
GridViewMultiComboBoxColumn cb = new GridViewMultiComboBoxColumn();
cb.HeaderText = " Link Document To Condition ";
cb.Width = 350;
cb.DisplayMember = "Link";
cb.ValueMember = "id";
cb.DataSource = dtCondtions;
radGridView1.CellBeginEdit += new GridViewCellCancelEventHandler(radGridView1_CellBeginEdit);
private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
if (this.radGridView1.ActiveEditor is RadMultiColumnComboBoxElement)
{
((RadGridView)((RadMultiColumnComboBoxElement)this.radGridView1.ActiveEditor).EditorControl).Columns[0].Width = 125;
}
}
I always gets the error, column count = 0,
Am I missing something here?
0
Hi Diego Guayan,
Thank you for writing.
Can you please try to use CellEditorInitialized instead of CellBeginEdit event. This should help you.
Let me know if you need anything else.
All the best,
Stefan
the Telerik team
Thank you for writing.
Can you please try to use CellEditorInitialized instead of CellBeginEdit event. This should help you.
Let me know if you need anything else.
All the best,
Stefan
the Telerik team