This is the client side code I’m using
<script type="text/javascript">
//global variables for the countries Combo
var locationsCombo;
function pageLoad() {
// initialize the global variables
// in this event all client objects
// are already created and initialized
locationsCombo = $find("<%= RadComboLocation.ClientID %>");
}
function LoadLocations(combo, eventArqs) {
var item = eventArqs.get_item();
locationsCombo.set_text("Loading...");
// this will fire the ItemsRequested event of the
// locations combobox passing the countryID as a parameter
locationsCombo.requestItems(item.get_value(), false);
}
function ItemsLoaded(combo, eventArqs) {
if (combo.get_items().get_count() > 0) {
// pre-select the first item
combo.set_text(combo.get_items().getItem(0).get_text());
combo.get_items().getItem(0).highlight();
}
combo.showDropDown();
}
</script>
This is the code for both combos on the ascx pag
<telerik:RadComboBox ID="RadComboCountry" runat="server" AppendDataBoundItems="True"
BorderStyle="None" CssClass="DropdownControlGridFormEditor" EnableScreenBoundaryDetection="False"
ListTextField="Text" ListValueField="Code" Skin="Outlook" OnClientSelectedIndexChanging="LoadLocations"
OnItemsRequested="RadComboCountry_ItemsRequested">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
<telerik:RadComboBox ID="RadComboLocation" runat="server" BorderStyle="None" CssClass="DropdownControlGridFormEditor"
DropDownWidth="150px" EnableScreenBoundaryDetection="False" ListTextField="Text"
ListValueField="Code" Skin="Outlook" OnClientItemsRequested="ItemsLoaded" OnItemsRequested="RadComboLocation_ItemsRequested">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
And this is the code in the code behind page
protected void RadComboCountry_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
try{
SFSUserControl.myUtil.BindCombos(RadComboCountry, "Country", true);
}
catch (Exception ex)
{
throw new Exception("RadComboCountry_ItemsRequested Error on " + Request.ServerVariables["Script_Name"].ToString() + "" + ex.Message);
}
}
protected void RadComboLocation_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
try{
if (SFSUserControl.myUtil.LocationItemExists("Location" + e.Text) == true)
{
SFSUserControl.myUtil.BindCombos(RadComboLocation, "Location" + e.Text, true);
}
else
{
RadComboLocation.SelectedValue = "None";
RadComboLocation.Enabled = false;
}
}
catch (Exception ex)
{
throw new Exception("RadComboLocation_ItemsRequested Error on " + Request.ServerVariables["Script_Name"].ToString() + "" + ex.Message);
}
}
| <table> |
| <tr> |
| <td class="AdminLabels"> |
| LEA: |
| </td> |
| <td> |
| <telerik:RadComboBox ID="ddlLEA" runat="server" AutoPostBack="True" MarkFirstMatch="True" |
| NoWrap="True" OnSelectedIndexChanged="ddlLEA_SelectedIndexChanged" Skin="Default" |
| Width="480px" Height="500px"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| <ExpandAnimation Type="OutQuart"></ExpandAnimation> |
| </telerik:RadComboBox> |
| </td> |
| </tr> |
| <tr> |
| <td style="vertical-align: top"> |
| <div class="floatLeft"> |
| <div class="AdminLabels"> |
| School: |
| </div> |
| <div class="AdminLabels"> |
| Acadamic Year: |
| </div> |
| <div class="AdminLabels"> |
| Are you a TITLE I School: |
| </div> |
| <div class="AdminLabels"> |
| Teacher List: |
| </div> |
| </div> |
| </td> |
| <td style="vertical-align: top"> |
| <div> |
| <asp:UpdatePanel ID="updtpnlSchools" runat="server"> |
| <ContentTemplate> |
| <div class="AdminLabels"> |
| <telerik:RadComboBox ID="ddlSchool" runat="server" Width="480px" AutoPostBack="True" |
| MarkFirstMatch="True" NoWrap="True" OnSelectedIndexChanged="ddlSchool_SelectedIndexChanged" |
| Skin="Default" AllowCustomText="True" Height="500px"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| <ExpandAnimation Type="OutQuart" /> |
| </telerik:RadComboBox> |
| </div> |
| <div class="AdminLabels"> |
| <telerik:RadComboBox ID="ddlFiscalYear" runat="server" Width="75px" DataSourceID="SqlDataSource_FiscalYears" |
| DataTextField="FiscalYear" DataValueField="FiscalYear" AutoPostBack="True" MarkFirstMatch="True" |
| NoWrap="True" Skin="Default" |
| onselectedindexchanged="ddlFiscalYear_SelectedIndexChanged" Height="200px"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| <ExpandAnimation Type="OutQuart" /> |
| </telerik:RadComboBox> |
| </div> |
| <div class="AdminLabels"> |
| <telerik:RadComboBox ID="ddlTitleone" runat="server" MarkFirstMatch="True" |
| NoWrap="True" Width="75px" Height="250px" RadComboBoxImagePosition="Right"> |
| <Items> |
| <telerik:RadComboBoxItem Value="--?--" Text="--?--" /> |
| <telerik:RadComboBoxItem Value="N" Text ="No" /> |
| <telerik:RadComboBoxItem Value="Y" Text ="Yes" /> |
| </Items> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| <ExpandAnimation Type="OutQuart" /> |
| </telerik:RadComboBox> |
| </div> |
| <div class="AdminLabels floatLeft"> |
| <asp:UpdatePanel ID="updpnlTeacher" runat="server"> |
| <ContentTemplate> |
| <telerik:RadComboBox ID="ddlTeachers" runat="server" MarkFirstMatch="True" |
| NoWrap="True" Skin="Default" AllowCustomText="True" |
| Width="200px" Height="500px"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| <ExpandAnimation Type="OutQuart" /> |
| </telerik:RadComboBox> |
| </ContentTemplate> |
| <Triggers> |
| <asp:AsyncPostBackTrigger ControlID="ddlSchool" EventName="SelectedIndexChanged" /> |
| <asp:AsyncPostBackTrigger ControlID="ddlFiscalYear" EventName="SelectedIndexChanged" /> |
| </Triggers> |
| </asp:UpdatePanel> |
| </div> |
| <asp:Button ID="btnload" Style="float: right" runat="server" Text="Display Teacher Information." |
| OnClick="btnload_Click" /> |
| </ContentTemplate> |
| <Triggers> |
| <asp:AsyncPostBackTrigger ControlID="ddlLEA" EventName="SelectedIndexChanged" /> |
| </Triggers> |
| </asp:UpdatePanel> |
| </div> |
| <asp:SqlDataSource ID="SqlDataSource_FiscalYears" runat="server" ConnectionString="<%$ ConnectionStrings:EdSHConnectionString %>" |
| SelectCommand="hqtSP_FiscalYears" SelectCommandType="StoredProcedure"></asp:SqlDataSource> |
| <asp:HiddenField ID="HiddenField1" runat="server" /> |
| </td> |
| </tr> |
| </table> |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| if (!IsPostBack) |
| { |
| try |
| { |
| TeacherInfo1.Visible = false; |
| ddlFiscalYear.SelectedValue = getfiscalyear().ToString(); |
| ddlLEA.DataSource = dds.Districts();//dds is a object used to verify user |
| ddlLEA.DataTextField = "District"; |
| ddlLEA.DataValueField = "testdistrictID"; |
| ddlLEA.DataBind(); |
| ddlLEA.Enabled = dds.EnableDistritcts; |
| if (dds.EnableDistritcts) |
| ddlLEA.AllowCustomText = true; |
| else |
| ddlLEA.AllowCustomText = false; |
| ddlSchool.DataSource = dds.Schools(AppropriateParameter); |
| ddlSchool.DataTextField = "School"; |
| ddlSchool.DataValueField = "testschoolID"; |
| ddlSchool.DataBind(); |
| ddlSchool.Enabled = dds.EnableSchools; |
| if (dds.EnableSchools) |
| ddlSchool.AllowCustomText = true; |
| else |
| ddlSchool.AllowCustomText = false; |
| ddlTeachers.DataSource = dds.Teachers(AppropriateParameters); |
| ddlTeachers.DataTextField = "TeacherName"; |
| ddlTeachers.DataValueField = "TeachernameID"; |
| ddlTeachers.DataBind(); |
| } |
| catch (Exception ex) |
| { |
| ErrHandler.WriteError(ex, ex.Message); |
| } |
| } |
| } |
| protected void ddlLEA_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| try |
| { |
| //update school list |
| ddlSchool.DataSource = dds.Schools(Appropriateparameters) |
| ddlSchool.DataTextField = "School"; |
| ddlSchool.DataValueField = "testschoolID"; |
| ddlSchool.DataBind(); |
| ddlSchool.Enabled = dds.EnableSchools; |
| //update teachers list |
| ddlTeachers.DataSource = dds.Teachers(Appropriateparameters); |
| ddlTeachers.DataTextField = "TeacherName"; |
| ddlTeachers.DataValueField = "TeachernameID"; |
| ddlTeachers.DataBind(); |
| } |
| catch (Exception ex) |
| { |
| ErrHandler.WriteError(ex, ex.Message); |
| } |
| } |
| //School Selected |
| protected void ddlSchool_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| try{ |
| //update teachers list |
| ddlTeachers.DataSource = dds.Teachers(Appropriateparameters); |
| ddlTeachers.DataTextField = "TeacherName"; |
| ddlTeachers.DataValueField = "TeachernameID"; |
| ddlTeachers.DataBind(); |
| School school = new School(); |
| school.EntityID = int.Parse(ddlSchool.SelectedValue.ToString()); |
| school.FiscalYear = int.Parse(ddlFiscalYear.SelectedValue.ToString()); |
| ddlTitleone.SelectedValue = school.Title(); |
| ddlTitleone.Enabled = school.Enabled; |
| //ddlTeachers.Focus(); |
| TeacherInfo1.Visible = false; |
| } |
| catch (Exception ex) |
| { |
| ErrHandler.WriteError(ex, ex.Message); |
| } |
| } |
I wanted to know which control I would use to create a menu like the one present on the Telerik ASP.NET AJAX Demos. I need menu that allows for hierarchy that is visually relatively simple (e.g. text and arrows). If the current page is in the menu items as a sub-item of a section, the menu also needs to expand the applicable parent section and select the current page from the menu.
For example: When visiting the following URL, http://demos.telerik.com/aspnet-ajax/tabstrip/examples/functionality/vertical/defaultcs.aspx, the Functionality section within TabStrip is expanded and the Vertical item is selected.
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadDock.aspx.cs" Inherits="RadDock" %> |
| <%@ 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></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadDockZone runat="server" id="RadDockZone1" EnableEmbeddedSkins="true"> |
| <telerik:RadDock id="RadDock1" Collapsed="true" Skin="Web20" EnableEmbeddedSkins="true" EnableDrag="false" DefaultCommands="ExpandCollapse" runat="server"> |
| <TitlebarTemplate> |
| TitleBar name |
| </TitlebarTemplate> |
| <ContentTemplate> |
| <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. |
| </p> |
| <p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. |
| </p> |
| </ContentTemplate> |
| </telerik:RadDock> |
| </telerik:RadDockZone> |
| </div> |
| </form> |
| </body> |
| </html> |