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

Want to display Name instead of Value in GridGroupbyExpression

3 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 16 May 2009, 10:53 PM
Hi,

I have used one of the columns as griddropdowncolumn. Datafield="resource_id" and  ListTextField="Resource_Name"  and ListValueField="Resource_ID" which i am getting this from another sqldatasource2.

What i need is, i want to display Resource_Name in GridGroupByExpression. I am getting resource_id which i don't want. I want only Resource Name.


<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" GridLines="None" 
        ShowGroupPanel="True" Skin="Sunset"
        <MasterTableView AutoGenerateColumns="False" CellSpacing="-1" DataSourceID="SqlDataSource1"
         
        <GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                        <SelectFields> 
                            <telerik:GridGroupByField FieldAlias="Resource-ID" FieldName="Resource_Name"  
                                HeaderValueSeparator=" : " FormatString="" HeaderText=""></telerik:GridGroupByField> 
                        </SelectFields> 
                        <GroupByFields> 
                            <telerik:GridGroupByField FieldName="Resource_Name" SortOrder="Descending" FieldAlias="Resource_Name" FormatString="" HeaderText=""></telerik:GridGroupByField> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions> 
         
         
         
         
            <Columns> 
                <telerik:GridBoundColumn DataField="Assignment" HeaderText="Assignment" SortExpression="Assignment" 
                    UniqueName="Assignment"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Task" HeaderText="Task" SortExpression="Task" 
                    UniqueName="Task"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M9_Sep" DataType="System.Int16" HeaderText="Sep" 
                    SortExpression="M9_Sep" UniqueName="M9_Sep"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M10_Oct" DataType="System.Int16" HeaderText="Oct" 
                    SortExpression="M10_Oct" UniqueName="M10_Oct"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M11_Nov" DataType="System.Int16" HeaderText="Nov" 
                    SortExpression="M11_Nov" UniqueName="M11_Nov"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M12_Dec" DataType="System.Int16" HeaderText="Dec" 
                    SortExpression="M12_Dec" UniqueName="M12_Dec"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M1_Jan" DataType="System.Int16" HeaderText="Jan" 
                    SortExpression="M1_Jan" UniqueName="M1_Jan"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M2_Feb" DataType="System.Int16" HeaderText="Feb" 
                    SortExpression="M2_Feb" UniqueName="M2_Feb"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M3_Mar" DataType="System.Int16" HeaderText="Mar" 
                    SortExpression="M3_Mar" UniqueName="M3_Mar"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M4_Apr" DataType="System.Int16" HeaderText="Apr" 
                    SortExpression="M4_Apr" UniqueName="M4_Apr"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="M5_May" DataType="System.Int16" HeaderText="May" 
                    SortExpression="M5_May" UniqueName="M5_May"
                </telerik:GridBoundColumn> 
                 
                    
                    <telerik:GridDropDownColumn DataField="Resource_Name" DataSourceID="SqlDataSource2" 
                        HeaderText="Resource" ListTextField="Resource_Name" ListValueField="Resource_id" DataType="System.Int32" 
                        UniqueName="UniqueTaskName"
                        </telerik:GridDropDownColumn>  
                 
                 
                <telerik:GridBoundColumn DataField="Resource_Name" DataType="System.Int64" HeaderText="Resource-Name" 
                    SortExpression="Resource_Name" UniqueName="Resource_Name" GroupByExpression="Resource_Name" Display="False"
                </telerik:GridBoundColumn> 
            </Columns> 
        </MasterTableView> 
        <ClientSettings AllowDragToGroup="True"
        </ClientSettings> 
    </telerik:RadGrid><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ResourceUtilizationDBConnectionString %>" 
        SelectCommand="SELECT [Assignment], [Task], [M9_Sep], [M10_Oct], [M11_Nov], [M12_Dec], [M1_Jan], [M2_Feb], [M3_Mar], [M4_Apr], [M5_May], [Resource_Name] FROM [Resource_Data] WHERE (([Resource_Year] = @Resource_Year) AND ([Resource_Month] = @Resource_Month) AND ([Resource_week] = @Resource_week))"
        <SelectParameters> 
            <asp:QueryStringParameter Name="Resource_Year" QueryStringField="RYear" Type="Int16" /> 
            <asp:QueryStringParameter Name="Resource_Month" QueryStringField="RMonth" Type="Int16" /> 
            <asp:QueryStringParameter Name="Resource_week" QueryStringField="RWeek" Type="Int16" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ResourceUtilizationDBConnectionString %>" 
        SelectCommand="SELECT [Resource_Name], [Resource_ID] FROM [Resource_Information]"
    </asp:SqlDataSource> 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 18 May 2009, 12:41 PM
Hi Syed,

Try setting the FieldAlias for the SelectFields as Resource_Name as shown below.

ASPX:
 
<GroupByExpressions>  
                    <telerik:GridGroupByExpression>  
                        <SelectFields>  
                            <telerik:GridGroupByField FieldAlias="Resource_Name" FieldName="Resource_Name"   
                                HeaderValueSeparator=" : " FormatString="" HeaderText=""></telerik:GridGroupByField>  
                        </SelectFields>  
                        <GroupByFields>  
                            <telerik:GridGroupByField FieldName="Resource_Name" SortOrder="Descending" FieldAlias="Resource_Name" FormatString="" HeaderText=""></telerik:GridGroupByField>  
                        </GroupByFields>  
                    </telerik:GridGroupByExpression>  
                </GroupByExpressions>  


Shinu.
0
Syed
Top achievements
Rank 1
answered on 18 May 2009, 10:07 PM
Still Resource_Name is display Resource_ID value.

Its just like             Resource_Name : 6




0
Stroika
Top achievements
Rank 1
answered on 11 Mar 2010, 07:24 AM
Hi
No Answer!

Thanks
Omar
Tags
Grid
Asked by
Syed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Syed
Top achievements
Rank 1
Stroika
Top achievements
Rank 1
Share this question
or