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

How to access element on user control rendered in RadContextMenu?

1 Answer 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 09 Oct 2012, 03:55 PM
I have a user control which has a combobox and two label.  The user control will be created inside of RadContextMenu.  I like to access label witnin this user control from Javacript.  Can you help me point out how I can do this?

User Control Definition

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Sample_CheckComboBox.ascx.cs" Inherits="StoneHorse3.Controls.Sample_CheckComboBox" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<br />
<table cellpadding="0" cellspacing="1"  width="88">
    <tr>    
        <td>
            <telerik:RadButton ID="btnFilter" runat="server" Text="Apply" Width="39px" Height="25px" OnClick="btnFilter_Click" >
                <Image ImageUrl="~/Images/bloombergyellowsmall.png" IsBackgroundImage="true" />
            </telerik:RadButton>                           
        </td>       
        <td>
            <telerik:RadButton ID="btnClear" runat="server" Text="Clear" Width="39px" Height="25px" onclick="btnFilterClear_Click"  >
                <Image ImageUrl="~/Images/bloombergyellowsmall.png" IsBackgroundImage="true" />
            </telerik:RadButton
        </td>
    </tr>
    <tr >
        <asp:Label ID="Label1" runat="server" Text=" "></asp:Label>
    </tr>       
    <tr>
        <th colspan="2">
            <telerik:RadComboBox ID="cmbFieldList" runat="server" AutoPostBack="true"
            OnItemDataBound="cmbFieldList_ItemDataBound" Style="z-index: 9000"
            OnClientDropDownClosing="radComboBox_OnClientDropDownClosing" OnClientDropDownOpening="radComboBox_OnClientDropDownOpening"
            >
            </telerik:RadComboBox>                   
            <asp:Label ID="lblFieldName" runat="server" Text="" ></asp:Label>
            <asp:Label ID="lblSectorID" runat="server" Text="" ></asp:Label>
        </th>                     
    </tr>
</table>
<br />

the label I like to gain access to are "lblFieldName" and "lblSectionID"

In Javascript I want to assign colUniqueName and sectorid to each of these two labels.

var filteredColId = "";
function showMenu(event, colUniqueName, filtertype, sectorid) {
            $find("<%=rcmCheckCombo.ClientID%>").show(event);
            ???lblFieldName= colUniqueName;
            ???lblSectorID= sectorid;
    }
}
How can I do something like this?  what would be the proper syntax? 

Thanks

Mark

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 12 Oct 2012, 01:23 PM
Hello Mark,

I prepared a sample project based on the provided code that demonstrates how you can access your label controls using jQuery.
Here you can find more information about using  jQuery with RadControls. Please follow this link to an example that demonstrates this approach.

I hope this was helpful.

Regards,
Boyan Dimitrov
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.
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or