6 Answers, 1 is accepted
Indeed, in this case, the control will be grouped by the value coming from the database, rather than the value set by the textfield. If you would like to alter the grouping behavior of the logic, you can also alter the group by expression. This may look something like:
.aspx
| <rad:GridDropDownColumn |
| DataField="City" |
| DataValueField="City" |
| ListTextField="Address" |
| ListValueField="City" |
| UniqueName="City1" |
| DataSourceID="AccessDataSource1" |
| GroupByExpression="Address GROUP BY Address"> |
| </rad:GridDropDownColumn> |
I hope this information helps.
Sincerely yours,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
<telerik:GridDropDownColumn CurrentFilterFunction="NoFilter"
DataField="CountryID" DataSourceID="dsCountry"
FilterListOptions="VaryByDataType"
ForceExtractValue="None"
HeaderText="Country"
ListTextField="ENLongDescription"
ListValueField="CountryID"
UniqueName="CountryID"
ColumnEditorID="0"
GroupByExpression=
"ENLongDescription GROUP BY ENLongDescription">
</telerik:GridDropDownColumn>
Attached to this message, is a sample application, which demonstrates the approach under discussion.
I hope it helps.
All the best,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
please show this example!
When i drag and drop Employee the groping spliter show the value filed
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
When i drag and drop Employee the groping spliter show the value filed not the
text filed<telerik:RadGrid ID="gvCity" runat="server"
AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" AllowMultiRowSelection="True" AllowPaging="True"
AutoGenerateColumns="False" AutoGenerateDeleteColumn="True"
AutoGenerateEditColumn="True" DataSourceID="AccessDataSource1" GridLines="None"
PageSize="30" ShowGroupPanel="True" ShowStatusBar="True" Skin="WebBlue"
style="margin-right: 8px" Width="491px">
<ExportSettings>
<Pdf FontType="Subset" PaperSize="Letter" />
<Excel Format="Html" />
<Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" />
</ExportSettings>
<PagerStyle Mode="Slider" />
<ClientSettings AllowDragToGroup="True">
<Selecting AllowRowSelect="true" />
</ClientSettings>
<mastertableview commanditemdisplay="Top" datakeynames="OrderID"
datasourceid="AccessDataSource1" editmode="EditForms" gridlines="None"
horizontalalign="Left" width="100%">
<CommandItemTemplate>
<div style="padding: 10px 0px;">
<asp:LinkButton ID="btnEditSelected" runat="server" CausesValidation="false"
CommandName="EditSelected" Style="vertical-align: bottom"
Visible="<%# gvCity.EditIndexes.Count == 0 %>"><img alt=""
src="Images/Grid/Edit.gif"
style="border:0px;vertical-align:middle;" /> Edit SelectedEdit Selected</asp:LinkButton>
<asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited"
Visible="<%# gvCity.EditIndexes.Count > 0 %>"><img alt=""
src="Images/Grid/Update.gif"
style="border:0px;vertical-align:middle;" /> Update CityUpdate City</asp:LinkButton>
<asp:LinkButton ID="btnCancel" runat="server" CausesValidation="false"
CommandName="CancelAll"
Visible="<%# gvCity.EditIndexes.Count > 0 || gvCity.MasterTableView.IsItemInserted %>"><img
alt="" src="Images/Grid/Cancel.gif"
style="border:0px;vertical-align:middle;" /> Cancel editingCancel editing</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert"
Visible="<%# !gvCity.MasterTableView.IsItemInserted %>"><img alt=""
src="Images/Grid/AddRecord.gif"
style="border:0px;vertical-align:middle;" /> AddAdd new
</asp:LinkButton>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false"
CommandName="DeleteSelected"
OnClientClick="javascript:return confirm('Delete all selected ?')"><img
alt="" src="Images/Grid/Delete.gif"
style="border:0px;vertical-align:middle;" /> Delete Selected </asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img
alt="" src="Images/Grid/Refresh.gif"
style="border:0px;vertical-align:middle;" /> Refresh
</asp:LinkButton>
</div>
</CommandItemTemplate>
<rowindicatorcolumn currentfilterfunction="NoFilter"
filterlistoptions="VaryByDataType" visible="False">
<HeaderStyle Width="20px" />
</rowindicatorcolumn>
<expandcollapsecolumn currentfilterfunction="NoFilter"
filterlistoptions="VaryByDataType" resizable="False" visible="False">
<HeaderStyle Width="20px" />
</expandcollapsecolumn>
<Columns>
<telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="OrderID"
DataType="System.Int32" FilterListOptions="VaryByDataType"
ForceExtractValue="None" HeaderText="OrderID" ReadOnly="True"
SortExpression="OrderID" UniqueName="OrderID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="OrderDate"
DataType="System.DateTime" FilterListOptions="VaryByDataType"
ForceExtractValue="None" HeaderText="OrderDate" SortExpression="OrderDate"
UniqueName="OrderDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn CurrentFilterFunction="NoFilter"
DataField="ShipAddress" FilterListOptions="VaryByDataType"
ForceExtractValue="None" HeaderText="ShipAddress" SortExpression="ShipAddress"
UniqueName="ShipAddress">
</telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataField="EmployeeID"
DataSourceID="AccessDataSource2" ListTextField="LastName"
ListValueField="EmployeeID" UniqueName="column" HeaderText="Employee">
</telerik:GridDropDownColumn>
</Columns>
<editformsettings captiondatafield="" columnnumber="2">
<FormTableItemStyle Wrap="False" />
<FormCaptionStyle CssClass="EditFormHeader" />
<FormMainTableStyle BackColor="White" CellPadding="3" CellSpacing="0"
GridLines="Horizontal" Width="100%" />
<FormTableStyle BackColor="White" BorderColor="#9966FF" BorderStyle="Solid"
BorderWidth="1px" CellPadding="2" CellSpacing="0" CssClass="module"
Height="110px" />
<FormTableAlternatingItemStyle Wrap="False" />
<EditColumn ButtonType="ImageButton" CancelImageUrl="../Images/Grid/Cancel.gif"
CancelText="Cancel edit" EditImageUrl="../Images/Grid/Edit.gif"
InsertImageUrl="../Images/Grid/Insert.gif" InsertText="Insert City"
UniqueName="EditCommandColumn1" UpdateImageUrl="../Images/Grid/Update.gif"
UpdateText="Update record">
</EditColumn>
<FormTableButtonRowStyle CssClass="EditFormButtonRow" HorizontalAlign="Right" />
<popupsettings scrollbars="None" />
</editformsettings>
</mastertableview>
</telerik:RadGrid>
</div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/Nwind.mdb"
SelectCommand="SELECT [OrderID], [OrderDate], [ShipAddress], [EmployeeID] FROM [Orders]">
</asp:AccessDataSource>
<asp:AccessDataSource ID="AccessDataSource2" runat="server"
DataFile="~/App_Data/Nwind.mdb"
SelectCommand="SELECT [EmployeeID], [LastName] FROM [Employees]">
</asp:AccessDataSource>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</form>
</body>
</html>
The textfield is taken from another source table. Hence, the grouping would fail if you specify a group by expression as suggested previously. If you would like to be able to group by the text field, you will need to specify a different group by expression. However, in order to include the other field as a group by expression, the field will need to come from the same source table as all other fields- in this case, AccessDataSource1.
If you would like to work-around this limitation, you can use the same datasource table - for example by using Join predicates, and merging the correlated tables. In any case, the datasource for the dropdown column, and the control need to be the same.
I hope this information helps.
Greetings,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thanx alot