This question is locked. New answers and comments are not allowed.
Hello, have good time
I have a page where it's a grid.
In this grid one of the columns is hidden where the user ID is and in the other column it fills the user name with another List in the event ItemDataBound
But when grouping it shows the user ID while I need the name to show it.
Aspx
01.<telerik:RadGrid ID="RadGrid1" runat="server" ShowFooter="true" AllowFilteringByColumn="true" GroupingEnabled="true" ShowGroupPanel="True"02. ClientSettings-AllowDragToGroup="true" AllowSorting="true" AllowPaging="true" PageSize="5" Skin="WebBlue" AllowMultiRowSelection="false" CellSpacing="-1" GridLines="Both"03. OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged" OnPageIndexChanged="RadGrid1_PageIndexChanged" OnItemDataBound="RadGrid1_ItemDataBound">04. <ClientSettings EnablePostBackOnRowClick="true">05. <Selecting AllowRowSelect="True" />06. <ClientEvents OnRowCreated="onRowCreated" OnRowSelected="onRowSelected" OnRowDeselected="onRowDeselected"07. OnGridCreated="gridCreated" OnGridCreating="masterTableCreating" />08. </ClientSettings>09. <GroupingSettings ShowUnGroupButton="true" GroupContinuesFormatString="" />10. <MasterTableView ShowGroupFooter="true" AutoGenerateColumns="False" DataKeyNames="Food_User_ID" ClientDataKeyNames="Food_ID_"11. NoMasterRecordsText="اطلاعاتی برای نمایش وجود ندارد">12. <Columns>13. <telerik:GridClientSelectColumn UniqueName="SelectColumn" Visible="true" />14. <telerik:GridTemplateColumn HeaderText="ردیف" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" Groupable="false">15. <ItemTemplate><%# (Container.ItemIndex+1).ToString() %> </ItemTemplate>16. </telerik:GridTemplateColumn>17. <telerik:GridBoundColumn DataField="Food_ID_" Groupable="false" DataType="System.Int32" FilterControlAltText="Filter Food_ID_ column"18. HeaderText="" ReadOnly="True" SortExpression="Food_ID_" UniqueName="Food_ID_" Visible="false" />19. <telerik:GridBoundColumn DataField="Food_Name" Groupable="true" FilterControlAltText="Filter Food_Name column"20. HeaderText="نام" SortExpression="Food_Name" UniqueName="Food_Name" />21. <telerik:GridBoundColumn DataField="Food_Price" Groupable="true" FilterControlAltText="Filter Food_Price column"22. HeaderText="قیمت" SortExpression="Food_Price" UniqueName="Food_Price" DataType="System.Int32" />23. <telerik:GridBoundColumn DataField="Food_Image" Groupable="false" FilterControlAltText="Filter Food_Image column"24. HeaderText="تصویر" SortExpression="Food_Image" UniqueName="Food_Image" />25. <telerik:GridBoundColumn DataField="Food_User_ID" Groupable="false" SortExpression="Food_User_ID"26. HeaderText="" UniqueName="User_ID" DataType="System.Int32" Visible="false" />27. <telerik:GridBoundColumn DataField="Food_User_ID" Groupable="true" FilterControlAltText="Filter Food_User_ID column"28. HeaderText="کاربر" SortExpression="Food_User_ID" UniqueName="UserFLName" DataType="System.Int32" />29. <telerik:GridCheckBoxColumn DataField="Food_Status" Groupable="false" DataType="System.Boolean" FilterControlAltText="Filter Food_Status column"30. HeaderText="وضعیت" SortExpression="Food_Status" UniqueName="Food_Status" />31. </Columns>32. </MasterTableView>33. <FilterMenu></FilterMenu>34. <HeaderContextMenu RenderMode="Classic"></HeaderContextMenu>35. </telerik:RadGrid>
C#
01.protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)02. {03. if (e.Item is GridDataItem)// to access a row 04. {05. GridDataItem item = (GridDataItem)e.Item;06. if (RadGrid1.GroupingEnabled)07. {08. item["UserFLName"].Text = LstUser.FindAll(x => x.User_ID_ == int.Parse(item["User_ID"].Text))[0].User_FName + " " + LstUser.FindAll(x => x.User_ID_ == int.Parse(item["User_ID"].Text))[0].User_LName;09. }10. }11.}