Client Side API - Find a RadComboBox Embedded in a User Control

2 posts, 0 answers
  1. Brian
    Brian  avatar
    7 posts
    Member since:
    Nov 2011

    Posted 01 Nov 2013 Link to this post

    I'm trying to find a RadComboBox on my ASP.Net form using the preferred syntax:
    var combo = $find("<%= RadComboBox1.ClientID %>");

    However, the combox box is actually embedded in a user control.  How can I reach that RadComboBox using the above javascript function?

    This doesn't seem to work:

    var combo = $find("<%= MyUserControl_RadComboBox1.ClientID %>");

    Where MyUserControl_RadComboBox1 is the unique id in the rendered markup.

    Thanks.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Nov 2013 Link to this post

    Hi Brian,

    Please have a look into the following code snippet to access a user control RadCombobox on Client Side.

    ASPX:
    <uc1:WebUserControl ID="WebUserControl1" runat="server" />

    JavaScript:
    <script type="text/javascript">
        function pageLoad() {
            var combo = $find('<% =WebUserControl1.RadComboBox1ClientID %>');
        }
    </script>

    ASCX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server">
        <Items>
            <telerik:RadComboBoxItem Text="Item1" runat="server" />
            <telerik:RadComboBoxItem Text="Item2" runat="server" />
        </Items>
    </telerik:RadComboBox>

    ASCX C#:
    public string RadComboBox1ClientID
    {
        get
        {
            return this.RadComboBox1.ClientID;
        }
    }

    Thanks,
    princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top