This is a migrated thread and some comments may be shown as answers.

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

1 Answer 54 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 01 Nov 2013, 02:55 PM
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.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 04 Nov 2013, 04:30 AM
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.
Tags
ComboBox
Asked by
Brian
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or