Help on accessing controls inside RadPanelItem via javascript

3 posts, 1 answers
  1. Julia
    Julia avatar
    3 posts
    Member since:
    May 2009

    Posted 15 May 2009 Link to this post

    Hi, I'd like to ask help on how can I access (set / get control's value)  inside my RadPanelItem

    Here's the scenario, I have this source code below.
    OnClientClose(oWnd), gives me the arguments I need (Name and NameId).
    However, I want to set the value back to LabelName and LabelNameId.

    Pelase help.

    Thanks!


    <script type="text/javascript"
            //<![CDATA[
            function openWin()
            {
                var oWnd = radopen("../Common/SelectCompany.aspx?Typ=", "RadWindow1");
                //oWnd.setSize(340, 340);
                //set a function to be called when RadWindow is closed
                oWnd.add_close(OnClientClose);
            }
            function OnClientClose(oWnd) {
                //get the transferred arguments
                var Name = oWnd.argument.Name;
                var NameId = oWnd.argument.NameId;
                
                //????
                $get("LabelName").value = Name;
            }
            //]]> 
        </script> 
     
     
    <telerik:RadPanelBar runat="server" ID="RadPanelBar1" Skin="Gray" Width="100%" Height="550px"
        <CollapseAnimation Type="None"></CollapseAnimation>     
        <Items> 
            <telerik:RadPanelItem Text="RadPanelItem7" Expanded="True" PreventCollapse="true"
                <Items> 
                    <telerik:RadPanelItem runat="server" Value="RadPanelItem7"
                        <ItemTemplate> 
                            <table width="100%"
                                <tr> 
                                    <td width="100px" class="style2">Name: </td> 
                                    <td> 
                                        <asp:TextBox ID="TextBox1" runat="server" Width="100px"></asp:TextBox> 
                                    </td> 
                                </tr> 
                                <tr> 
                                    <td class="style2">Long Name: </td> 
                                    <td> 
                                        <asp:Label ID="LabelName" runat="server" Text="Please select..."></asp:Label> 
                                        <asp:imagebutton id="btnSearch" runat="server" CausesValidation="False" 
                                            ImageUrl="~/Images/find.gif" ToolTip="Search"></asp:imagebutton> 
                                        <button onclick="openWin(); return false;"
                                            Select</button> 
                                        <asp:Label ID="LabelNameId" runat="server"></asp:Label> 
                                    </td> 
                                </tr> 
                                <tr> 
                                    <td class="style2">Status: </td> 
                                    <td><asp:DropDownList ID="ddlStatus" runat="server"></asp:DropDownList></td
                                </tr>     
                            </table> 
                            <br /> 
                        </ItemTemplate>           
                    </telerik:RadPanelItem>               
                </Items> 
            </telerik:RadPanelItem> 
            <telerik:RadPanelItem Text="RadPanelItem9" Expanded="True"
                <Items> 
                    <telerik:RadPanelItem runat="server" Value="RadPanelItem9"
                        <ItemTemplate>     
                        List...               
                        <br /><br /> 
                        </ItemTemplate>           
                    </telerik:RadPanelItem>               
                </Items> 
            </telerik:RadPanelItem> 
            <telerik:RadPanelItem Text="RadPanelItem8" Expanded="True"
                <Items> 
                    <telerik:RadPanelItem runat="server" Value="RadPanelItem8"
                        <ItemTemplate>  
                        List...                                          
                        <br /><br /> 
                        </ItemTemplate>           
                    </telerik:RadPanelItem>               
                </Items> 
            </telerik:RadPanelItem> 
        </Items> 
        <ExpandAnimation Type="None"></ExpandAnimation> 
    </telerik:RadPanelBar> 
    </div> 
    <telerik:RadWindowManager Modal="true"  
        Behaviors="Maximize,Minimize,Move,Pin,Reload,Resize,Close"  
            ID="RadWindowManager1" ShowContentDuringLoad="true" runat="server"   
            VisibleStatusbar="false" 
             Width="400px" Height="400px" 
            Skin="Default"
    </telerik:RadWindowManager> 



  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 May 2009 Link to this post

    Hello Julia,

    You can refer to the following demo which explains on how to access any control embedded in a RadPanelBar's template:
    Accessing Nested Controls

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. christian
    christian avatar
    7 posts
    Member since:
    Jul 2011

    Posted 10 Apr 2012 Link to this post

    For anyone who passes this thread....

    Couldn't get it working until I found this link, the key was using a ContentTemplate:
    http://www.telerik.com/help/aspnet-ajax/panelbar-templates-accessing-controls.html
Back to Top