I am running into an issue picking up control clientIDs when it comes to master/content pages. For example, using $find("<%= controlName.ClientID %>") in a single page would allow me to access the controls id. However, if I place the same code in a content page, I get a 'null' error. It cannot find the control. Below is the content page I am attempting to access a controls ID. Any help would be appreciated.
<%@ Page Title="" Language="C#" MasterPageFile="~/MES.master" AutoEventWireup="true" CodeBehind="timesheet.aspx.cs" Inherits="ESPS.Timesheet.timesheet" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <asp:ScriptManagerProxy runat="server"></asp:ScriptManagerProxy> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> var btn = $find("<%# rBtnTest.ClientID %>"); alert(btn); </script> </telerik:RadCodeBlock> <div style="background-color: Blue;"> <telerik:RadButton runat="server" ID="rBtnTest" Text="Test" /> </div> </asp:Content>
Disregard this post, I have figured the out the problem.