Simple RadCombo Client Side Example

2 posts, 0 answers
  1. Jennifer
    Jennifer avatar
    2 posts
    Member since:
    May 2011

    Posted 31 May 2011 Link to this post

    I am trying a test with the RadComboBox client side stuff and I can't get it to work. It should be a very simple thing to display the selected item text in an alert. The code is below. What I am doing wrong?

    <script language="javascript" type="text/javascript">
          function OnClientSelectedIndexChangedHandler(item)
            {
                alert(item.Text);
            }
     </script>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
        <telerik:RadComboBox ID="DocumentsTypeRadComboBox" runat="server" Filter="StartsWith" DataTextField="Name" DataValueField="ObjectUID" OnClientSelectedIndexChanged="OnClientSelectedIndexChangedHandler">
            <Items>
                <telerik:RadComboBoxItem Text="Item1" Value="1" />
                <telerik:RadComboBoxItem Text="Item2" Value="2" />
            </Items>
        </telerik:RadComboBox>
        </div>
  2. Jennifer
    Jennifer avatar
    2 posts
    Member since:
    May 2011

    Posted 31 May 2011 Link to this post

    Never mind: I replaced the javascript function with:

    function OnClientSelectedIndexChangedHandler(sender, eventArgs) {
            var item = eventArgs.get_item();
            alert("You selected " + item.get_text());
            }

    And It works now.
Back to Top