GroupByExpression with fixed or Enum values

4 posts, 0 answers
  1. Delvis
    Delvis avatar
    18 posts
    Member since:
    Mar 2012

    Posted 08 Feb 2013 Link to this post

    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?
  2. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 13 Feb 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Delvis
    Delvis avatar
    18 posts
    Member since:
    Mar 2012

    Posted 14 Feb 2013 Link to this post

    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
  5. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 19 Feb 2013 Link to this post

    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.
Back to Top