e.Positions is Empty

2 posts, 0 answers
  1. Alec
    Alec avatar
    43 posts
    Member since:
    Mar 2009

    Posted 02 Sep 2009 Link to this post

    I have a radDockLayout which somehow has the e.Positions being empty.

     <telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnLoadDockLayout="RadDockLayout1_LoadDockLayout" onsavedocklayout="RadDockLayout1_SaveDockLayout" storelayoutinviewstate="false"
                                           <div class="signature"
                                                 
                                                <asp:Panel ID="pnlPreview" runat="server" CssClass="zones"></asp:Panel> 
                                                 <br /><br /><asp:Button ID="btnSave" runat="server" Text="Save Layout"  />&nbsp; &nbsp;  
                                              
                                           </div> 
                                            
                                           <div class="preview"
                                                <asp:Repeater ID="rptContentType" runat="server" OnItemDataBound="rptContentType_OnItemDataBound"
                                                    <HeaderTemplate><ul id="contentlibrary"></HeaderTemplate> 
                                                    <ItemTemplate> 
                                                        <li> 
                                                        <h2> 
                                                            <span class="title"><%#DataBinder.Eval(Container.DataItem,"Title") %></span
                                                            <asp:Image ID="imgIcon" runat="server" CssClass="icon" /></h2
                                                            <telerik:RadDockZone id="radDockZone" runat="server" Height="150"></telerik:RadDockZone> 
                                                            <asp:Repeater ID="rptContentLibrary" runat="server" OnItemDataBound="rptContentLibrary_OnItemDataBound"></asp:Repeater> 
                                                        </li> 
                                                    </ItemTemplate> 
                                                    <FooterTemplate></ul></FooterTemplate> 
                                                 
                                                </asp:Repeater> 
                                                 
                                           </div> 
                                    </telerik:RadDockLayout> 

      protected void RadDockLayout1_LoadDockLayout(object sender, Telerik.Web.UI.DockLayoutEventArgs e) 
            { 
                HttpCookie positionsCookie = Request.Cookies[Request["id"] + "CompanyEmailLayout"]; 
                if (!Object.Equals(positionsCookie, null)) 
                { 
                    string serializedPositionsAndIndices = positionsCookie.Value; 
                    if (!string.IsNullOrEmpty(serializedPositionsAndIndices)) 
                    { 
                        JavaScriptSerializer serializer = new JavaScriptSerializer(); 
                        string[] positionsAndIndices = serializer.Deserialize<string[]>(serializedPositionsAndIndices); 
     
                        e.Positions = serializer.Deserialize<Dictionary<stringstring>>(positionsAndIndices[0]); 
                        e.Indices = serializer.Deserialize<Dictionary<stringint>>(positionsAndIndices[1]); 
                    } 
                } 
            } 
     
            protected void RadDockLayout1_SaveDockLayout(object sender, Telerik.Web.UI.DockLayoutEventArgs e) 
            { 
                JavaScriptSerializer serializer = new JavaScriptSerializer(); 
                string serializedPositions = serializer.Serialize(e.Positions); 
                string serializedIndices = serializer.Serialize(e.Indices); 
     
                HttpCookie positionsCookie = new HttpCookie(Request["id"] + "CompanyEmailLayout"
                    serializer.Serialize(new string[] { serializedPositions, serializedIndices })); 
     
                //Ensure that the cookie will not expire soon 
                positionsCookie.Expires = DateTime.Now.AddYears(1); 
                Response.Cookies.Add(positionsCookie); 
     
                if (IsPostBack) 
                { 
                    //my codes 
     
                } 
            } 

    The problem is ... somehow, when i click on the save button, and breakpointing into //my codes, the e.Positions and Indices have empty content. That's really weird. Am I missing something?


  2. Alec
    Alec avatar
    43 posts
    Member since:
    Mar 2009

    Posted 02 Sep 2009 Link to this post

    Solved. I had !IsPostBack in page_init...
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top