Unexpected Behavior embedding dockzone in ItemTemplate.

4 posts, 1 answers
  1. SungamRammah
    SungamRammah avatar
    10 posts
    Member since:
    Jul 2007

    Posted 22 Jun 2009 Link to this post

    The page compiles and on the surface the zones work as expected, but the radDockZone inside the (RadPanelBar) item template shows up as RadDockZone1 <RADDOCKZONE> in the properties window and not like expected RadDockZone2 Telerik.Web.UI.RadDockZone.
    Consequently it is not accessible from Code behind.

    Is this a expected limitation?

    Thanks,
    / Magnus.

    Edit: Adding Aspx code. RadDockZone1 is not accessible from code behind.

    <body> 
        <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        </telerik:RadAjaxManager> 
        <div> 
            Header 
            <asp:Button ID="Button1" runat="server" Text="Button" /> 
        </div> 
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
            <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%"
                <telerik:RadPane ID="RadPane1" runat="server"
                    <telerik:RadPanelBar ID="RadPanelBar1" runat="server"
                        <Items> 
                            <telerik:RadPanelItem runat="server" Text="Templates"
                                <ItemTemplate> 
                                Templates  
                                </ItemTemplate> 
                            </telerik:RadPanelItem> 
                            <telerik:RadPanelItem runat="server" Text="Results"
                                <ItemTemplate> 
                                    <telerik:RadDockZone ID="RadDockZone1" runat="server" Height="300px" Width="300px"
                                        <telerik:RadDock ID="RadDock1" runat="server" Width="300px"
                                            <ContentTemplate> 
                                                Results 
                                            </ContentTemplate> 
                                        </telerik:RadDock> 
                                    </telerik:RadDockZone> 
                                </ItemTemplate> 
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelBar> 
                </telerik:RadPane> 
                <telerik:RadSplitBar ID="RadSplitBar1" runat="server" /> 
                <telerik:RadPane ID="RadPane2" runat="server"
                    <telerik:RadDockZone ID="RadDockZone2" runat="server" Height="300px" Width="300px"
                        <telerik:RadDock ID="RadDock2" runat="server" Width="300px"
                            <ContentTemplate> 
                                Documents 
                            </ContentTemplate> 
                        </telerik:RadDock> 
                    </telerik:RadDockZone> 
                </telerik:RadPane> 
            </telerik:RadSplitter> 
        </telerik:RadDockLayout> 
        </form> 
    </body> 

  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 23 Jun 2009 Link to this post

    Hi Magnus,

    There is not any unexpected behavior. What is displayed on the Properties window depends whether the page is viewed in Design View or Source View.
    • Design View - RadDockZone2 is shown as Telerik.Web.UI.RadDockZone and Button1 is shown as System.Web.UI.WebControls.Button
    • Source View - RadDockZone2 sometimes is shown as <RADDOCKZONE> and sometimes as Telerik.Web.UI.RadDockZone. Button1 sometimes is shown as <BUTTON> and sometimes as System.Web.UI.WebControls.Button

    I have attached screen shots that show the explained behavior. I think that this issue is related to the Visual Studio, and not to Telerik ASP.NET AJAX RadControls (or the Microsoft ASP.NET controls).

    For accessing the RadDockZone from the Code behind make sure that you have declared: 
    using Telerik.Web.UI; 


    Sincerely,
    Pero
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. SungamRammah
    SungamRammah avatar
    10 posts
    Member since:
    Jul 2007

    Posted 24 Jun 2009 Link to this post

    Thank you for your input... I am starting to feel guilty now leaning on your support resources while still just evaluating the product. Still I can't keep from following up with some more details about the problem. I think I confused things and totally missed the point.

    I made a composite of three screen shots, where we can see that I declare RadDockZone1 and RadDockZone2... they idd render correctly, but as the red wiggly line indicates I can only reference the RadDockZone2 but not the Zone that lies within the itemTemplate.

    Screenshot Magnus Can't Compile

    I hereby promise that this will be the last question before license :) promise!

    /Magnus
  4. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 25 Jun 2009 Link to this post

    Hi Magnus,


    To get an instance to the RadDockZone1 (or Button2) you should get an instance to RadPanelItem

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using Telerik.Web.UI; 
     
    namespace UnexpectedBehabior221403 
        public partial class _Default : System.Web.UI.Page 
        { 
            protected void Page_Load(object sender, EventArgs e) 
            { 
                RadDockZone zone = (RadDockZone)RadPanelBar1.FindItemByText("Results").FindControl("RadDockZone1"); 
                zone.Width = Unit.Pixel(1000); 
     
                Button button = (Button)RadPanelBar1.FindItemByText("Results").FindControl("Button2"); 
                button.Text = "BUTTON TEXT CHANGED"
            } 
        } 

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="UnexpectedBehabior221403._Default" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager" runat="server"
        </asp:ScriptManager> 
        <div> 
            Header 
            <asp:Button ID="Button1" runat="server" Text="Button" /> 
        </div> 
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
            <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%"
                <telerik:RadPane ID="RadPane1" runat="server"
                    <telerik:RadPanelBar ID="RadPanelBar1" runat="server"
                        <Items> 
                            <telerik:RadPanelItem runat="server" Text="Templates"
                                <ItemTemplate> 
                                    Templates 
                                </ItemTemplate> 
                            </telerik:RadPanelItem> 
                            <telerik:RadPanelItem runat="server" Text="Results"
                                <ItemTemplate> 
                                    <asp:Button ID="Button2" runat="server" Text="ButtonText" /> 
                                    <telerik:RadDockZone ID="RadDockZone1" runat="server" Height="300px"
                                        <telerik:RadDock ID="RadDock1" runat="server" Width="300px"
                                            <ContentTemplate> 
                                                Results 
                                            </ContentTemplate> 
                                        </telerik:RadDock> 
                                    </telerik:RadDockZone> 
                                </ItemTemplate> 
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelBar> 
                </telerik:RadPane> 
                <telerik:RadSplitBar ID="RadSplitBar1" runat="server" /> 
                <telerik:RadPane ID="RadPane2" runat="server"
                    <telerik:RadDockZone ID="RadDockZone2" runat="server" Height="300px" Width="300px"
                        <telerik:RadDock ID="RadDock2" runat="server" Width="300px"
                            <ContentTemplate> 
                                Documents 
                            </ContentTemplate> 
                        </telerik:RadDock> 
                    </telerik:RadDockZone> 
                </telerik:RadPane> 
            </telerik:RadSplitter> 
        </telerik:RadDockLayout> 
        </form> 
    </body> 
    </html> 


    You can see that the Width of the RadDockZone1 is changed to 1000px, by dragging the dock that is inside. Also the text of the button is changed from "ButtonText" to "BUTTON TEXT CHANGED".



    Kind regards,
    Pero
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top