<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!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">
        <telerik:radscriptmanager id="RadScriptManager1" runat="server" />
        <telerik:radcombobox id="Categories" runat="server" onclientselectedindexchanged="Categories_SelectedIndexChanged"
            onitemsrequested="RadComboBox1_ItemsRequested" />
        <telerik:radcombobox id="SubCategories" runat="server" onitemsrequested="RadComboBox2_ItemsRequested" />
    </form>
    <script type="text/javascript">
        function Categories_SelectedIndexChanged(sender, args)
        {
            var categoriesCombo = $find("<%= Categories.ClientID %>");
            var subCombo = $find("<%= SubCategories.ClientID %>");

            var item = args.get_item();
            
            if (item.get_index() > 0) {
                subCombo.requestItems(item.get_value(), false);
                subCombo.showDropDown();
            }
            else {
                subCombo.set_text(" ");
                subCombo.clearItems();
            }
        }
    </script>
</body>
</html>
