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...

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

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

    Posted 26 Aug 2010 Link to this post

    Hello,


    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


    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top