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

Setting DropDownWidth of GridDropDownColumn

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
esmyy
Top achievements
Rank 1
esmyy asked on 11 Sep 2012, 06:58 AM
Hello everyone,
I'm searching for a solution to set a DropDownWidth in my GridDropDownColumn.
I'm loading the Grid dynamically, just like this demo and I want to be able to edit and insert data in this Grid.
So there are this GridDropDownColumns and the text is showing in two lines, but I want to be able to set the width so that the text is in one line and the Combobox of this GridDropDownColumns is larger. Is there a solution for this problem?

Thanks in advance,
Esmi

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Sep 2012, 07:20 AM
Hi,

You can set the width of the RadComboBox as shown below.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
   if (e.Item is GridEditableItem && e.Item.IsInEditMode)
   {
       GridEditableItem eitem = (GridEditableItem)e.Item;
       RadComboBox RadComboBox1 = (RadComboBox)eitem["UniqueName"].Controls[0];
       RadComboBox1.Width = Unit.Pixel(250);
   }
}

Thanks,
Shinu.
0
esmyy
Top achievements
Rank 1
answered on 11 Sep 2012, 07:37 AM
Hi Shinu,
many thanks for your fast reply.
I think I didn't explain it right.. in the attachment you can see what I want to do.
I only want the dropdownlist of the column to be larger, just like you can set this in the radcombobox with the "dropdownwidth" - property.

I hope the file attached helps you to understand my problem.

Regards, Esmi
0
Shinu
Top achievements
Rank 2
answered on 12 Sep 2012, 04:08 AM
Hi Esmi ,

I am not quite sure about your requirement. You can increase the dropdownlist with using either 'DropDownWidth' property of RadComboBox or through CSS.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
   if (e.Item is GridEditableItem && e.Item.IsInEditMode)
   {
       GridEditableItem eitem = (GridEditableItem)e.Item;
       RadComboBox RadComboBox1 = (RadComboBox)eitem["UniqueName"].Controls[0];
       RadComboBox1.DropDownWidth = Unit.Pixel(250);
       RadComboBox1.DropDownCssClass = "DropDownCSS";
   }
}

OR

CSS:
<style type="text/css">
        .DropDownCSS
        {
            width:250px !important;
        }
</style>

Thanks,
Shinu.
Tags
Grid
Asked by
esmyy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
esmyy
Top achievements
Rank 1
Share this question
or