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

Rad Grid - Group By - DropDownColumn text instead of value

3 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justyn
Top achievements
Rank 1
Justyn asked on 28 Sep 2010, 07:29 PM
GridGroupByExpression exp = GridGroupByExpression.Parse("group by " + name);
GridGroupByField field = new GridGroupByField();
field.FieldAlias = "Group";
field.FieldName = name;
exp.SelectFields.Add(field);
rg.MasterTableView.GroupByExpressions.Add(exp);
I have a rad grid that I am creating dynamicaly.
The grid has a drop down box control in it along with other fields such as text.

GridDropDownColumn gdc = new GridDropDownColumn();
gdc.Visible = visible;
gdc.DataField = uniqueName;
gdc.HeaderText = headerText;
gdc.ListTextField = "Value";
gdc.ListValueField = "ListValueId";
gdc.UniqueName = uniqueName;
gdc.DropDownControlType = GridDropDownColumnControlType.DropDownList;
When I group by the drop down column, I get it grouped by the value instead of the text. 

Is there a way to specify which one?

I need value and text to be different so making them the same is not a solution.

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 01 Oct 2010, 09:07 AM
Hello Justyn,

This scenario is not currently supported by RadGrid. The GridDropDownColumn can be sorted by the DataField(ListValueField) only.

Veli
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
0
Alfonso
Top achievements
Rank 1
answered on 27 Oct 2014, 11:34 AM
Hi,

Is this functionality still not supported? I am trying to achieve this.

Thanks in advance.

Alfonso
0
Eyup
Telerik team
answered on 30 Oct 2014, 01:36 PM
Hello Alfonso,

To achieve the requested functionality, you can replace the dropdown column with GridTemplateColumn:
<telerik:GridTemplateColumn UniqueName="TemplateColumnName" DataField="TextFieldName">
    <ItemTemplate>
        <asp:Label ID="Label1" runat="server" Text='<%# Eval("TextFieldName") %>'></asp:Label>
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadComboBox ID="RadComboBox1" runat="server"
            DataSourceID="SqlDataSource2" DataTextField="TextFieldName"
            DataValueField="ValueFieldName" SelectedValue='<%# Bind("ValueFieldName") %>'>
        </telerik:RadComboBox>
    </EditItemTemplate>
</telerik:GridTemplateColumn>

Hope this helps.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Justyn
Top achievements
Rank 1
Answers by
Veli
Telerik team
Alfonso
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or