Jake Gearhart Jake Gearhart - 1 year ago 141
ASP.NET (C#) Question

$find returning null when retrieving telerik controls in javascript

I am trying to write a javascript function to show and hide a telerik:RadAjaxLoadingPanel, but for some reason when I try to use the $find function it always comes back as null even after the controls are loaded.

I am new to asp.net development can someone tell me what is going wrong?

My telerik control .aspx code

<telerik:RadAjaxLoadingPanel ID="ModalLoadingPanel" runat="server" Transparency="10" BackColor="#E0E0E0" Modal="true">
<div style="margin-left: auto; margin-right: auto; margin-top: 45px; margin-bottom: auto; width: 135px; height: 80px;"
<div class="spinner"></div>

My javascript function that exists in a tag

function showActivityIndicator() {
var loadingPanel = $find("<%= ModalLoadingPanel.ClientID %>");


Answer Source


$("#<%= ModalLoadingPanel.ClientID %>").find();

$ is a function which takes a selector and if the selector is an ID it should be prepended with # sign.

Actually you don't even need find unless you need to do further filtration. So this will get you the tag:

$("#<%= ModalLoadingPanel.ClientID %>");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download