prometheus usage - help with scriptmanager functions

4 posts, 0 answers
  1. alexta
    alexta avatar
    8 posts
    Member since:
    Dec 2006

    Posted 31 Jul 2007 Link to this post

    Can someone explain to me in more detail the usage of the following function? I think I understand what it is doing, but I cannot modify it to do what I need. It is found here: http://www.telerik.com/DEMOS/ASPNET/Prometheus/Dock/Examples/MyPortal/DefaultCS.aspx

    ... below is the function usage:

    ScriptManager.RegisterStartupScript(
                dock,
                this.GetType(),
                "AddDock",
                string.Format(@"function _addDock() {{
        Sys.Application.remove_load(_addDock);
        $find('{1}').dock($find('{0}'));
        $find('{0}').doPostBack('DockPositionChanged');
    }};
    Sys.Application.add_load(_addDock);", dock.ClientID, DropDownZone.SelectedValue),
                true);

    If you go to the link I provided above, you see that it is adding docks every time you click a button. In my situation I need to add docks based on a list of RadDocks that I am passed. I have not been able to do this for some reason.

    I tried something like this:

            List<RadDock> dockList = RetrieveListOfDocks();

            foreach (RadDock dock in dockList)
            {
                UpdatePanel1.ContentTemplateContainer.Controls.Add(dock);

                ScriptManager.RegisterStartupScript(
                dock,
                this.GetType(),
                "AddDock",
                string.Format(@"function _addDock() {{
                Sys.Application.remove_load(_addDock);
                $find('{1}').dock($find('{0}'));
                $find('{0}').doPostBack('DockPositionChanged');
                }};
                Sys.Application.add_load(_addDock);", dock.ClientID, RadDockZone1),
                true);
            }

    But given my limited understanding of the control functions and the new framework, this did not work. My ultimate goal is to do a partial page postback (using the UpdatePanel) with different collections of RadDocks each time... so an event is fired, and new RadDocks appear in a RadDockZone of a page... Any help and guidance would be great.

  2. Petya
    Admin
    Petya avatar
    869 posts

    Posted 31 Jul 2007 Link to this post

    Hello alexta,

    As far as I see from your code the only modification you have made was transforming DropDownZone.SelectedValue into RadDockZone1. This does not work because the function is expecting string as a parameter. Please, test with "RadDockZone1" or RadDockZone1.ClientID. Let me know how it goes.

    All the best,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. alexta
    alexta avatar
    8 posts
    Member since:
    Dec 2006

    Posted 31 Jul 2007 Link to this post

    Now i get only one control added then a postback, and then back to a blank zone again..
    on debugging, the code hits the page_load (which is empty) then the foreach loop, the loop runs for as many items in the collection, but when it is done only one control gets added instead of the whole collection.. 
    then the page_load again, which clears out my controls..
    is this even the right approach w/ the script manager?
  5. Petya
    Admin
    Petya avatar
    869 posts

    Posted 31 Jul 2007 Link to this post

    Hi alexta,

    Obviously you are struggling with dynamic creation of RadDocks, so I believe it will be easier for us to help you if you could isolate the problematic scenario in a simple running project that you will send us so we can review it and provide assistance. I am attaching instructions how you can open a support ticket where you can attach files. Furthermore, please provide detailed information on what you expect to happen and what actually happens - I need to know what you try to achieve to be able to offer suggestions for modifications of your code. looking forward to your answer.

    Kind regards,
    Petya
    the Telerik team

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