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

[Solved] Grouping not displaying FieldAlias

2 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Redmond Rinehart
Top achievements
Rank 1
Redmond Rinehart asked on 03 Jun 2009, 05:31 PM
Hi there, I have a RadGrid (Q1 2009 release) and I want to group by the LanguageID that I am pulling from my LinqDataSource while displaying the accompanying Language instead of the ID.  I am attempting to use the FieldAlias for the Language, but this is not working.  Here is my code.  My LinqDataSource is pulling: SurveyID, SurveyGroupID, SurveyGroupName, LanguageID, Language from the database directly.  I can group by anything, but no matter what I group by, the FieldAlias does not do anything.


<telerik:RadGrid ID="rdgSurveys" runat="server" DataSourceID="ldsSurveys" GridLines="None" Skin="Office2007" AutoGenerateColumns="False"
        <MasterTableView DataKeyNames="SurveyID" DataSourceID="ldsSurveys" GroupLoadMode="Client"
          <RowIndicatorColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
          </RowIndicatorColumn> 
          <ExpandCollapseColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
          </ExpandCollapseColumn> 
          <Columns> 
            <telerik:GridButtonColumn Text="Select" CommandName="Select"
            </telerik:GridButtonColumn> 
            <telerik:GridEditCommandColumn> 
            </telerik:GridEditCommandColumn> 
            <telerik:GridBoundColumn DataField="SurveyID" DataType="System.Int32" HeaderText="SurveyID" ReadOnly="True" SortExpression="SurveyID" UniqueName="SurveyID"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="SurveyGroupID" DataType="System.Int32" HeaderText="SurveyGroupID" SortExpression="SurveyGroupID" UniqueName="SurveyGroupID" Visible="False" ReadOnly="true"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="SurveyGroupName" DataType="System.String" HeaderText="SurveyGroupName" SortExpression="SurveyGroupName" UniqueName="SurveyGroupName" Visible="False" ReadOnly="true"
            </telerik:GridBoundColumn> 
            <telerik:GridTemplateColumn DataField="LanguageID" DataType="System.Int32" HeaderText="Language" SortExpression="LanguageID" UniqueName="LanguageID"
              <EditItemTemplate> 
                <asp:DropDownList ID="ddlLanguages" runat="server" DataSourceID="ldsLanguages" DataTextField="Language" DataValueField="LanguageID" SelectedValue='<%# Bind("LanguageID") %>' Width="200px"
                </asp:DropDownList> 
              </EditItemTemplate> 
              <ItemTemplate> 
                <asp:Label runat="server" ID="lblLanguage" Text='<%# Eval("Language") %>'></asp:Label> 
              </ItemTemplate> 
            </telerik:GridTemplateColumn> 
          </Columns> 
          <GroupByExpressions> 
            <telerik:GridGroupByExpression> 
              <SelectFields> 
                <telerik:GridGroupByField FieldName="LanguageID" FieldAlias="Language" HeaderText="Survey Group" /> 
              </SelectFields> 
              <GroupByFields> 
                <telerik:GridGroupByField FieldName="LanguageID" FieldAlias="Language" /> 
              </GroupByFields> 
            </telerik:GridGroupByExpression> 
          </GroupByExpressions> 
          <EditFormSettings> 
            <EditColumn UniqueName="EditCommandColumn1"
            </EditColumn> 
          </EditFormSettings> 
        </MasterTableView> 
        <ClientSettings Selecting-AllowRowSelect="True" EnablePostBackOnRowClick="True"
          <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
        <FilterMenu EnableTheming="True"
          <CollapseAnimation Type="OutQuint" Duration="200"
          </CollapseAnimation> 
        </FilterMenu> 
      </telerik:RadGrid> 

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 04 Jun 2009, 01:33 PM
Hello Redmond,

Unfortunately I could not reproduce this issue. I created a test project in my attempt to recreate the abnormality explained so far. I used the latest official build of RadControls. I've attached my sample web site project to this support thread. You can also review this online help article devoted on the same matter.

Kind regards,
Georgi Krustev
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
Redmond Rinehart
Top achievements
Rank 1
answered on 04 Jun 2009, 07:02 PM
Thanks Georgi, I looked at the article that you linked to and I just changed the order of the SelectFields and the GroupByFields and changed the FieldName of the SelectFields to Language and everything worked.  I think I was just a little unclear on the difference in the GroupByFields and the SelectFields.  Thanks again.
Tags
Grid
Asked by
Redmond Rinehart
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Redmond Rinehart
Top achievements
Rank 1
Share this question
or