<%@ 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.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
<script type="text/javascript">
function onClientItemsRequesting(sender, eventArgs)
{
    var context = eventArgs.get_context();
    context["text"] = eventArgs.get_text();
}
</script>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
            <telerik:RadGrid ID="RadGrid1" 
            AutoGenerateColumns="false"
            runat="server" 
            OnNeedDataSource="RadGrid1_NeedDataSource" 
            OnUpdateCommand="RadGrid1_UpdateCommand" 
            OnItemCreated="RadGrid1_ItemCreated">
            <MasterTableView DataKeyNames="CustomerID" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame="Border" TableLayout="Auto">
                <Columns>
                    <telerik:GridEditCommandColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"></telerik:GridEditCommandColumn>
                    
                    <telerik:GridDropDownColumn
                        DropDownControlType="RadComboBox" 
                        UniqueName="ComboColumn" 
                        ListTextField="ContactName" 
                        ListValueField="CustomerID" 
                        ListDataMember="Customers" 
                        HeaderText="Contact name" 
                        DataField="CustomerID" >
                    </telerik:GridDropDownColumn>  
                    <telerik:GridTemplateColumn 
                        DataField="CustomerID"
                        UniqueName="ComboColumn2"
                        HeaderText="Contact Address" >
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="RadComboBox1" 
                                    runat="Server" 
                                    Text='<%# Bind("Address") %>'
                                    EnableLoadOnDemand="true" 
                                    OnItemsRequested="RadComboBox1_ItemsRequested" 
                                    OnClientItemsRequesting="onClientItemsRequesting">
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                        <ItemTemplate>
                         <%# Eval("Address") %>
                        </ItemTemplate>
                        </telerik:GridTemplateColumn>              
                </Columns>
            </MasterTableView>
            </telerik:RadGrid>
        </div>
    </form>
</body>
</html>
