<%@ Page AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="DropDownTree.Examples.ApplicationScenarios.DropDownTreeInGrid.DefaultCS"Language="c#" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
<title>Telerik ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid2">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<qsf:MessageBox ID="InformationBox1" runat="server" Type="Info" Icon="Info">
Edit the grid entries to be able to adjust the supplier name with the help of the RadDropDownTree.
The control shows the suppliers' hierarchy.
</qsf:MessageBox>
<div class="demo-container">
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2" GridLines="None" AutoGenerateColumns="false" PageSize="20"
AllowPaging="true" AllowSorting="true" runat="server" OnItemDataBound="RadGrid2_ItemDataBound"
DataSourceID="SqlDataSource1" AllowAutomaticUpdates="true"
ShowStatusBar="true" OnItemCreated="RadGrid2_ItemCreated">
<MasterTableView ShowFooter="false" TableLayout="Fixed" EditMode="InPlace" CommandItemDisplay="TopAndBottom" CommandItemSettings-ShowAddNewRecordButton="false">
<SortExpressions>
<telerik:GridSortExpression FieldName="TerritoryID" SortOrder="Ascending" />
</SortExpressions>
<Columns>
<telerik:GridTemplateColumn HeaderText="Supplier Name">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "LastName")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownTree RenderMode="Lightweight" runat="server" ID="RadDropDownTreeTest" DataTextField="LastName" DataFieldParentID="ReportsTo"
DataFieldID="EmployeeID" OnDataBound="RadDropDownTreeTest_DataBound"
DataValueField="EmployeeID" DataSourceID="SqlDataSource2" SelectedValue='<%#Bind("EmployeeID") %>'>
<DropDownSettings OpenDropDownOnLoad="true" CloseDropDownOnSelection="true" />
</telerik:RadDropDownTree>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="TerritoryDescription" HeaderText="Territory" />
<telerik:GridBoundColumn DataField="TerritoryID" HeaderText="TerritoryID" />
<telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"
HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update">
</telerik:GridEditCommandColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</div>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"
SelectCommand="SELECT EmployeeID, ReportsTo, LastName FROM [Employees]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"
SelectCommand="SELECT mediator.[EmployeeID], mediator.[TerritoryID], territories.[TerritoryDescription], empl.[LastName]
FROM [EmployeeTerritories] AS mediator
INNER JOIN Employees AS empl
ON mediator.EmployeeID = empl.EmployeeID
INNER JOIN Territories AS territories
ON mediator.TerritoryID = territories.TerritoryID"
UpdateCommand="UPDATE EmployeeTerritories
SET EmployeeTerritories.EmployeeID = @EmployeeID
WHERE EmployeeTerritories.TerritoryID = @TerritoryID">
<UpdateParameters>
<asp:Parameter Name="EmployeeID" Type="Int32" />
<asp:Parameter Name="TerritoryID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</form>
</body>
</html>