This is a migrated thread and some comments may be shown as answers.

e.Positions is Empty

1 Answer 51 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Alec
Top achievements
Rank 1
Alec asked on 02 Sep 2009, 07:44 AM
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?


1 Answer, 1 is accepted

Sort by
0
Alec
Top achievements
Rank 1
answered on 02 Sep 2009, 08:06 AM
Solved. I had !IsPostBack in page_init...
Tags
Dock
Asked by
Alec
Top achievements
Rank 1
Answers by
Alec
Top achievements
Rank 1
Share this question
or