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

[Solved] How can i set empty message for grid dropdown column?

1 Answer 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chennaiah P
Top achievements
Rank 1
chennaiah P asked on 17 Mar 2010, 10:47 AM
in GridDropdownColumn i am generating dropdown when i click the addnew record button,i need to dispaly --select-- in dropdown by default.

Chennaiah

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Mar 2010, 12:04 PM
Hello Chennaiah,

The EmptyMessage property can be used only when the AllowCustomText property is set to True. Here is the code snippet that I tried to set the EmptyMessage for the combobox (rendered in EditMode) from code behind.

CS:
 
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridEditFormItem && (e.Item.IsInEditMode)) 
            { 
                RadComboBox combo = (RadComboBox)((GridEditFormItem)e.Item)["GridDropDownColumn"].Controls[0]; 
                combo.AllowCustomText = true
                combo.EmptyMessage = "Select one"
            } 
        } 

Set the DropDownControlType property of DropDownColumn to "RadComboBox" in order to access the control as RadComboBox.

-Shinu.
Tags
Grid
Asked by
chennaiah P
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or