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

GroupByExpression with fixed or Enum values

3 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Delvis
Top achievements
Rank 1
Delvis asked on 08 Feb 2013, 07:03 PM

I have  a GridTemplateColumn bind to “State” data field and the values are fixed or Enum type:

<telerik:GridTemplateColumn DataField="State" DataType="System.Byte" DefaultInsertValue="1"

    UniqueName="StateColumn" GroupByExpression="State Group By State">

    <EditItemTemplate>

        <telerik:RadComboBox ID="StateRadComboBox" runat="server"

SelectedValue='<%#Bind("State")%>'>

            <Items>

                <telerik:RadComboBoxItem runat="server" Text="Active" Value="1" />

                <telerik:RadComboBoxItem runat="server" Text="Inactive" Value="2" />

                <telerik:RadComboBoxItem runat="server" Text="Erased" Value="3" />

                <telerik:RadComboBoxItem runat="server" Text="Pendent" Value="4" />

            </Items>

        </telerik:RadComboBox>

    </EditItemTemplate>

    <ItemTemplate>

        <asp:Label ID="StateLabel" runat="server"

Text='<%# … a logic to get text based on numeric value '></asp:Label>

    </ItemTemplate>

</telerik:GridTemplateColumn>

When forms a group show the numerical value (State: 1, State: 2, State: 3 or State: 4). How can I show your description instead of the numerical value (State: Active, State: Inactive, State: Erased or State: Pendent)?

 

I have the same problem when use GridDropDownColumn and ObjectDataSource:

<telerik:GridDropDownColumn DataField="State" DataSourceID="StateObjectDataSource"

    ListTextField="TextValue" ListValueField="ByteValue" UniqueName="StateColumn"

    DataType="System.Byte">

</telerik:GridDropDownColumn>

Any help?

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 13 Feb 2013, 02:10 PM
Hi Delvis,

When you set the GroupByExpression property for a GridTemplateColumn instance, a common problem is that RadGrid cannot get the value from the header text for that column and display it in the GroupHeaderItem. More about grouping could be found at the following help article.
Additionally I prepared a small sample and attached it to this forum post. Give it a try and let me know about the result.

Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Delvis
Top achievements
Rank 1
answered on 14 Feb 2013, 04:30 PM
Hi Kostadin,

I appreciate your response. The example I provided does not solve the problem I have. I need an example based on my scenario.

Thanks,

Delvis
0
Kostadin
Telerik team
answered on 19 Feb 2013, 01:34 PM
Hi Delvis,

I prepared a small sample based on your code and attached it to this thread.. Give it a try and let me know how it differs from your real setup.

Greetings,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Delvis
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Delvis
Top achievements
Rank 1
Share this question
or