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

prometheus usage - help with scriptmanager functions

3 Answers 113 Views
Dock
This is a migrated thread and some comments may be shown as answers.
alexta
Top achievements
Rank 1
alexta asked on 31 Jul 2007, 02:52 PM
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.

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 31 Jul 2007, 03:09 PM
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
0
alexta
Top achievements
Rank 1
answered on 31 Jul 2007, 03:18 PM
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?
0
Petya
Telerik team
answered on 31 Jul 2007, 03:33 PM
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
Tags
Dock
Asked by
alexta
Top achievements
Rank 1
Answers by
Petya
Telerik team
alexta
Top achievements
Rank 1
Share this question
or