Dynamic Dock problems with multiple Update Panels

9 posts, 0 answers
  1. Chris
    Chris avatar
    33 posts
    Member since:
    Jan 2007

    Posted 18 Jun 2007 Link to this post

    UPDATE:
    -----------------------
    After playing with this for the better part of the day, I've gotten to the point to where I have gotten rid of the hidden updatepanel (see original msg below) for my dynamically added docks and simply wrapped everything, including my normal asp.net command buttons in one updatepanel.

    The problem that has stopped me dead in the road - to the point where I might have to just stop using this control all together - is that when I drag and drop the dock it works perfectly fine for a couple of times. Then suddenly I get this viewstate error message on a drop and it then does it for every drag and drop:

    "Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request."

    Please if anyone has a solution for this it would help me immensely as I don't know what else to do at this point.

    Chris


    EDIT: Original Message Below:
    -----------------------------------------
    Hello,

    I split my questions over two threads (and also updated my last old thread) since the topics are suffiently different and it might make it easier for others to search and find a topic of it's not all jammed into one post. 

    My question has to do with Dynamically loaded docks, which use the hidden update panel, and how command buttons in a separate updatepanel can interact with the Docks control since it can't be wrapped in an updatepanel itself (using the hidden updatepanel method that you guys are promoting for more efficent AJAX interactions).

    What I'm specfically doing is dynamically loading a bunch of docks with user controls within them for a given 'page'. At the top of the page is a couple of buttons that do things like load the 'next page'. This originally (before adding the dock control) occured without postbacks using updatepanels. The original main placeholder that I dynamically loaded user controls in was wrapped in a UpdatePanel with triggers for those command buttons in the other update panels.

    So now that I am using the docks control as my 'pseudo panel' to load user controls and I CAN'T wrap that in an UpdatePanel if I want to use the hidden updatepanel 'method', how can I get my buttons to trigger the DOCK panel to reload on page_init? As it is, they can't be "seen" since the control itself is not wrapped in the updatepanel. And it doesn't seem adding triggers to the hidden updatepanel does the trick either.

    Thanks,
    Chris
  2. Chris
    Chris avatar
    33 posts
    Member since:
    Jan 2007

    Posted 20 Jun 2007 Link to this post

    Just thought I'd post the solution I found to my viewstate problem. All I did was disable viewstate for the DockLayout and the one DockZone control that I was dynamically loading docks into. I really only used the viewstate in the UserCtrls loaded WITHIN the docks anyway. Then with those 'changing viewstate control hiearchies/structures' out of the way I know longer got the viewstate error mentioned above.

    Question for Telerik though - unless I'm just not understanding the process here (quite possible) - shouldn't the Dock control be able to properly manage it's Viewstate when repositioning the docks? As it seems right now the Dock control is not updating the Viewstate on the server with Dynamically loaded docks and throws that error. Anyway, just curious.

    PAGE_INIT DOCK LAYOUT REQUIREMENT QUESTION
    As a side question, it appears that I can only really dynamically load docks in the Page_Init event, otherwise the Docks aren't loaded properly by the DockLayout control. This is a bit inconvient because typically I could reload a standard panel control with new user controls by calling my load procedure in a button click event. But I can't do that with the Docks because the Page_Init event has to fire - so the only way I can think of to do this is to trigger a postback within the click event. This appears to be what you've done in your examples when Adding a dynamic dock in a button click event. Is there some kind of RegisterClientStartUpScript I can create that would cause an immediate 'general postback' (within my update panel, so asynchronous) and hence fire the Page_Init event? I apologize if this question is more appropriate for the general ASP.NET forumn, I just saw your Add script and it looked very much like what I needed.

    Thanks!
    Chris
  3. Petya
    Admin
    Petya avatar
    869 posts

    Posted 21 Jun 2007 Link to this post

    Hello Chris,

    We find it appropriate to explain a bit how RadDock works in terms of page life cycle. Here is a list of how a  page + controls life cycle takes place:

    Page.PreInit
    Controls.Init
    Page.Init
    Page.TrackViewState
    Controls.TrackViewState
    Page.InitComplete <-- RadDockLayout.LoadDockLayout
    if (IsPostBack)
    {
        Page.LoadViewState <-- 1
        Controls.LoadViewState
    }
    ((IPostBackDataHandler)Controls).LoadPostData <-- RadDock.DockPositionChanged
    Page.PreLoad <-- 5
    Page.Load
    Controls.Load
    Controls.DataChangedEvents (such as TextBox.TextChanged)
    Controls.PostBackEvents (such as Button.Click) <-- 4
    Page.LoadComplete
    Page.PreRender
    Controls.PreRender
    Page.PreRenderComplete
    Controls.SaveViewState <-- 2
    Page.SaveViewState
    Page.SaveStateComplete <-- RadDockLayout.SaveDockLayout
    Render

    Using the numbers above here are the important points:

    1) On postback the control tree should be exactly the same as it was in 2) If it isn't you will get ViewState exceptions

    2) This is the last moment where you can access the ViewState

    3) The controls should be created if you want to use their PostData or PostEvents 4)

    5) RadDockLayout rearranges the RadDock controls according to the information collected from the DockPositionChanged events

    The last event where you can save the docks' positions is SaveDockLayout. However, you could do it in any other event, but you should ensure that the positions are not changed until SaveViewState.
     LoadDockLayout is the last event where you should rebuild the docks. You could do it also in Page.Init if you want to avoid the usage of LoadDockLayout.
    RadDockLayout rearranges the registered docks just after it raises LoadDockLayout, according to the supplied position information (args.Indices, args.Positions). RadDockLayout rearranges the registered docks for the second time according their client state in Page.PreLoad. This is done by registering to their DockPositionChanged events.

    Please, review your code and make sure that you use RadDock in accordance with these explanations. If you are absolutely sure that your code follows them, then please, send us some simplified sample code that we could run and review plus information on what you try to achieve so that we could provide some guidance.

    Sincerely yours,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. Chris
    Chris avatar
    33 posts
    Member since:
    Jan 2007

    Posted 22 Jun 2007 Link to this post

    Petya,

    Thanks for the description of how RadDock fits into the ASP.NET page lifecycle. That is definately good information to have. However, at this point, I think I'd like to take you up on your offer and just create a simplified code example I can send you as it would probably make things much clearer as to what I'm trying to do and what problems I'm running into.

    How/where can I send you the code as an attachment?

    Thanks!
    Chris
  5. Petya
    Admin
    Petya avatar
    869 posts

    Posted 22 Jun 2007 Link to this post

    Hello Chris,

    To be able to send an attachment you need to send a "Support ticket" from you Client.Net account. I am attaching a screenshot where you need to go to achieve this. Looking forward to your new support thread.

    Greetings,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. John
    John avatar
    10 posts
    Member since:
    Apr 2007

    Posted 10 Jul 2007 Link to this post

    Splitter, Pane, split bar, Pane, Slider Panel, Sliding Pane.
    Construct two simple pages using the method described in the tutorial.
    Page one is constructed using the Rad Controls. It works
    Page two is constructed using Prometheous this control allows the pane to open but does not allow the flyout to close.
    There is no documented alternate construction method.
    I have not attempted the construction in code method,  that is detailed in the manual as it seems pointless to debug a more complex project when the very simple application shows an error.
    How can this be resolved
    AspNet 3.0, WindowsXP Sp2
    John
  7. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 11 Jul 2007 Link to this post

    Hello John,
    We are not aware of such an issue with the Prometheus RadSplitter. I used the code from this help topic to test your scenario, but could not reproduce the problem.

    Could you please prepare and send us a simple project, together with bin folder, with which we can reproduce the problem?

    Kind regards,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. John
    John avatar
    10 posts
    Member since:
    Apr 2007

    Posted 12 Jul 2007 Link to this post

    I ran the samples built a project based on the code that works fine.
    This may indicate that the registration process (or assembly cache???) was not correct on my system.
    The sliding pane differs from the fixed pane in that contentsUrl is not valid.
    The use of a contents page was important to us as we wished to encapsulate the UI logic from the content. Any ideas?
    John
  9. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 16 Jul 2007 Link to this post

    Hi John,
    I understand that if you create a new project, everything works as expected and the only problem is with your old project that you wish to migrate to Prometheus RadSplitter. If this is correct, please refer to our online documentation for information.
    Otherwise, please provide detailed information on the problem you have run into, so that we are able to help you.

    Best wishes,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top