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

No dataformatstring for GridDropDownColumn?

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 05 Nov 2010, 11:14 PM
Can someone please confirm that the GridDropDownColumn doesnt have a dataformatstring property.  If it doesnt, can one be implemented without messing up the grid editing/inserting?  If it matters, I am trying to use "<div class="xxxxxx">{0}</div>".

Additionally, I have temporarily created a TemplateColumn with a radcombobox.  When using the radgrid automatic updates, everything updates correctly except for the combobox values which dont appear to do anything.  When in edit mode, the combobox displays as it should with the correct selectedvalue.  Should I be using a controlparameter with my sqldatasource, because a regular parameter is having no effect?

Thanks for any help with my problems above.

Joshua Zimmerman

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 10 Nov 2010, 02:15 PM
Hi Josh,

I do confirm that the GridDropDownColumn does not support such a property. However, you can change the way drop-down column data is displayed by attaching an event handler to the ItemDataBound event and modifying the content of the table cell to be rendered:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        ((GridDataItem)e.Item)["DropDownColumnUniqueName"].Text = String.Format("Columns content: {0}", ((GridDataItem)e.Item)["DropDownColumnUniqueName"].Text);
    }
}

In case, you are using a template column with a RadComboBox you should set a binding expression for the SelectedValue property of the combo in your mark-up. Do note that the SelectedValue property is hidden from Visual Studio's intellisense, however, it nonetheless is fully functional and essential for applying two way data-binding for the combo: SelectedValue='<%#Bind("DropDownColumnDataField")'%>.

Hope it helps.

Best wishes,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Josh
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or