Dropdown List with RadComboBox

2 posts, 0 answers
  1. Greg
    Greg avatar
    6 posts
    Member since:
    Mar 2012

    Posted 28 Feb 2013 Link to this post

    I have a datalist (dlLockNumber) with a RadComboBox Control (rcbLockSeriesLockNumbers) in it. Depending on the number of records in the datalist, there could be one to 100 (or more) RadComboBox instances of rcbLockSeriesLockNumbers. I have a RadButton named "rbSelect" for each RadComboBox that is disabled upon page load - so that when someone selects some value other than the default ("-1"), the desired event is to enable the button. I have a javascript function named OnClientSelectedIndexChanged that hopefully would work but it does not. If any of you Javascript sharpies could take a look at the function and steer me in the right direction, it would be appreciated.

    Here is the HTML side of the code - this is part of a .NET User Control:
    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Keys.ascx.vb" Inherits="Controls_Keys" %>
    <telerik:RadCodeBlock ID="rcblock1" runat="server">
    <script language="javascript" type="text/javascript">
        function OnClientSelectedIndexChanged(sender, eventArgs) {
            var item = eventArgs.get_item();
            var ddl = $find("<%= dlKeySeries.ClientID %>");
            var button = ddl.get_items().getItem(0).findControl("rbSelect");
            var strValue = item.options[item.selectedIndex].value;
            if (strValue == "-1") {
            else {
    <telerik:RadAjaxPanel ID="rapKeys" runat="server">
    <asp:Panel ID="pnlKeysTrue" Visible="true" runat="server">
    <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
            <td class="BlackSmall">
            <br />
                <asp:Literal ID="litSectionTitle" runat="server" /><br />
                <asp:Literal ID="litSectionIntro" runat="server" />
        <tr id="trrcKeySeries" runat="server">
            <td class="BlackSmall">
                <br />
                <asp:DataList ID="dlLockNumber" DataKeyField="SeriesLockID" OnItemDataBound="dlLockNumber_ItemDataBound" Width="100%" RepeatDirection="Vertical" RepeatColumns="3" runat="server">
                        <asp:Label ID="lblSeriesLockID" Visible="false" runat="server"><%#Databinder.Eval(Container.DataItem, "SeriesLockID") %></asp:Label>
                        <table border="0" cellpadding="0" cellspacing="0">
                                <td valign="top" style="width:196px;text-align:center">
                                    <telerik:RadComboBox ID="rcbLockSeriesLockNumbers" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" CausesValidation="false" AppendDataBoundItems="true" DataValueField="LockNumberID" Width="130px" ZIndex="20000" DataTextField="LockNumber" AutoPostBack="true" runat="server"  />
                                    <telerik:RadButton ID="rbSelect" Enabled="false" Skin="Sunset" OnClick="rbSelect_OnClick" runat="server" Text="Select" />
  2. Hristo Valyavicharski
    Hristo Valyavicharski avatar
    975 posts

    Posted 01 Mar 2013 Link to this post

    Hello Greg,

    With the current implementation the button is enabled in the ClientSelectedIndexChanged event, at the same time you have AutoPostBack="true" which will cause a post back once the selection is changed. Since the RadButton does not persists its enabled value when changed client-side, my suggestion is to change it in the server SelectedIndexChanged event of the RadComboBox.

    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top