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

[Solved] EmptyMessage for GridDropDownColumn

3 Answers 131 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mehdi Mirza
Top achievements
Rank 1
Mehdi Mirza asked on 16 Jun 2009, 03:24 PM
hello,

Is there a possibility for "GridDropDownColumn" have an "EmptyMessage" just like RadComboBox?
I know we can use EnableEmptyListItem="true" EmptyListItemText="Select Model" property. But then the empty value shows in the dropdown which i dont want.
I want it to dissapear just like RadComboBox and not show up in the selection.


thanks

MM

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Jun 2009, 04:10 PM
Hello Mehdi,

You can set the EmptyText using the column editor:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
    { 
        GridEditableItem item = e.Item as GridEditableItem; 
        GridDropDownListColumnEditor editor = item.EditManager.GetColumnEditor("ddc1"as GridDropDownListColumnEditor; 
        editor.ComboBoxControl.EmptyMessage = "No text"
    } 

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Mehdi Mirza
Top achievements
Rank 1
answered on 17 Jun 2009, 04:37 PM
hello,

this didnt work for me, here is my code

 

 

If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then

 

 

 

 

Dim item As GridEditableItem = CType(e.Item, GridEditableItem)

 

Dim editor As GridDropDownListColumnEditor = CType(item.EditManager.GetColumnEditor("ModelID"), GridDropDownListColumnEditor)
editor.ComboBoxControl.EmptyMessage =
"Select Model"

 

Dim editor1 As GridDropDownListColumnEditor = CType(item.EditManager.GetColumnEditor("SalesAccountType"), GridDropDownListColumnEditor)
editor1.ComboBoxControl.EmptyMessage =
"Select Account Type"

 

 

 

 

 

End If

MM

 

 

 

 

 

 

 

 

 

 

 

0
Princy
Top achievements
Rank 2
answered on 18 Jun 2009, 06:03 AM
Hello Mehdi,

You can try setting the AllowCustomText property of the control together with the EmptyMessage as shown below. This should probably solve your issue.
vb:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) 
    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then 
        Dim item As GridEditableItem = TryCast(e.Item, GridEditableItem) 
        Dim editor As GridDropDownListColumnEditor = TryCast(item.EditManager.GetColumnEditor("DropDownColumn"), GridDropDownListColumnEditor) 
        editor.ComboBoxControl.AllowCustomText = True 
        editor.ComboBoxControl.EmptyMessage = "No text" 
    End If 
End Sub 

Thanks
Princy.
Tags
Grid
Asked by
Mehdi Mirza
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Mehdi Mirza
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or