Getting error while accessing items inside panelbar

2 posts, 0 answers
  1. Aamir Ali Ansari
    Aamir Ali Ansari avatar
    22 posts
    Member since:
    Jun 2010

    Posted 26 Aug 2010 Link to this post

    Dear Telerik team

    Kindly review the sample code below for an idea of what I need to acheive...

    I am getting following error on compilation...The similar script is working fine with page not using Panelbar...

    The name 'txtRegister' does not exist in the current context

    <script language="javascript" type="text/javascript">
        function btnTemplate_onclick() {
     function checkscript(){
                var editor = $find("<%=txtRegister.ClientID  %>"); //get a reference to RadEditor client object
                mytext = editor.get_html(true);
    //Some more steps
    <telerik:RadPanelBar ID="RadPanelBar1" Runat="server" Width="750px" 
        AllowCollapseAllItems="True" Skin="Office2007">
    <telerik:RadPanelItem runat="server" Text="Deleted Templates" 
                    <telerik:RadPanelItem runat="server" Value="Test">
    <telerik:RadEditor ID="txtRegister" Runat="server" EditModes="Html" 
                                            Height="100px" ReadOnly="false" Skin="Sitefinity" ToolbarMode="ShowOnFocus" 
                                            Width="100%" Visible="False">
    <input id="btnTemplate" type="button" value="Do Something" onclick="return btnTemplate_onclick()" />
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Aug 2010 Link to this post


    Since the txtRegister control placed inside the panelbar, you need to get reference to corresponding panelbaritem and then access the editor control.

    The following documentation shows more information on this.
    Accessing Controls Inside Templates

Back to Top