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

Styling ColumnEditor

2 Answers 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rayne
Top achievements
Rank 1
Rayne asked on 02 Oct 2013, 09:25 PM
I am using a drop down column in my grid. I used a Column Editor to set the width of the drop down used in edit mode. Setting the width works, but...

I want to set the control style of my column to a RadComboBox, but I want the control to use a different skin from the grid. So I set the ComboBoxControl-Skin on the ColumnEditor. 

This doesn't work. I get an error on the page: Object reference not set to an instance of an object.

Is there a way to get this to work? I can use a dropdown list and a form decorator, but it doesn't give me quite the same look.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 03 Oct 2013, 06:03 AM
Hi Rayne,

Please try the following code snippet to apply skin to the GridDropDownColumn in edit mode.

ASPX:
<telerik:GridDropDownColumn UniqueName="ShipCity" DataSourceID="SqlDataSource2" DropDownControlType="RadComboBox" SortExpression="ShipCity" ListTextField="ShipCity" ListValueField="ShipCity"   HeaderText="ShipCity" DataField="ShipCity" />

C#:
protected void myRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridEditableItem && e.Item.IsInEditMode)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
           GridEditManager editMan = editedItem.EditManager;
           GridDropDownListColumnEditor editor = editMan.GetColumnEditor("ShipCity") as GridDropDownListColumnEditor;        
           editor.ComboBoxControl.Width = Unit.Pixel(100);
           editor.ComboBoxControl.Skin = "Black";      
       }
   }

Hope this helps,else please provide your code snippet.

Thanks,
Princy
0
Rayne
Top achievements
Rank 1
answered on 03 Oct 2013, 01:18 PM
Thanks! that worked perfectly.
Tags
Grid
Asked by
Rayne
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Rayne
Top achievements
Rank 1
Share this question
or