Hi all,
I have been using Telerik's tutorials on how to dynamically add docks to a dock zone. Inside of my dock is a chart which has drill-down capability. I do not seem to be doing something correctly, however. When the user interacts with the chart (it seems) that some of the dock's initially set properties are being forgotten.
Image: http://i.imgur.com/3Qrqn.png
The upper image is a freshly created dock zone. The second image is moments after the user clicked a series on the chart and 'drilled down.' I placed breakpoints throughout my code and it seems that the upper bar is disappearing before Page_Init is called.
In addition, if the user refreshes the page or grabs the dock and drags it, then allows it to drop back onto the dock zone, it resets to its initial state. The title bar becomes present again.
Here is the relevant code I have written:
RadDockLayout1_SaveDockLayout, LoadDockLayout, CurrentDockStates, CreateRadDockFromState are identical to those given in your examples. I believe the above should all be mostly identical, if not identical, as well.
The only difference I can see between my example and http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx is that my example does not use a 2nd UpdatePanel. Instead, I am using the RadAjaxManager to refresh the view after a user has drag/dropped/created a dock.
Does this seem correct? Can I provide more information?
Sean
EDIT: I see why the state of the graph reverts to its top level view. During page_init all the docks call LoadContent again to, in theory, reload the content they were displaying before. In practice, a user has navigated one level deep into the chart and then LoadContent is called -- this retrieves the top level of the chart, not one level deep. Any advice on how to handle this scenario would be much appreciated -- I do not see a great way of handling this.
I have been using Telerik's tutorials on how to dynamically add docks to a dock zone. Inside of my dock is a chart which has drill-down capability. I do not seem to be doing something correctly, however. When the user interacts with the chart (it seems) that some of the dock's initially set properties are being forgotten.
Image: http://i.imgur.com/3Qrqn.png
The upper image is a freshly created dock zone. The second image is moments after the user clicked a series on the chart and 'drilled down.' I placed breakpoints throughout my code and it seems that the upper bar is disappearing before Page_Init is called.
In addition, if the user refreshes the page or grabs the dock and drags it, then allows it to drop back onto the dock zone, it resets to its initial state. The title bar becomes present again.
Here is the relevant code I have written:
protected
void
RadListBox_Dropped(
object
sender, RadListBoxDroppedEventArgs e)
{
foreach
( RadListBoxItem item
in
e.SourceDragItems)
{
RadDock dock = CreateRadDock();
dock.Tag = item.Text;
dock.Title = dock.Tag + CurrentDockStates.Count.ToString();
RadDockZone1.Controls.Add(dock);
CreateSaveStateTrigger(dock);
LoadContent(dock);
}
}
private
RadDock CreateRadDock()
{
RadDock dock =
new
RadDock();
dock.DockMode = DockMode.Docked;
dock.UniqueName = Guid.NewGuid().ToString().Replace(
"-"
,
"a"
);
//Why am I replacing with 'a' here?
dock.ID =
string
.Format(
"RadDock{0}"
, dock.UniqueName);
dock.Title =
"Dock"
;
dock.Skin = RadDockLayout1.Skin;
dock.Width = Unit.Pixel(200);
dock.EnableRoundedCorners =
true
;
return
dock;
}
private
void
CreateSaveStateTrigger(RadDock dock)
{
dock.AutoPostBack =
true
;
dock.CommandsAutoPostBack =
true
;
AsyncPostBackTrigger saveStateTrigger =
new
AsyncPostBackTrigger();
saveStateTrigger.ControlID = dock.ID;
saveStateTrigger.EventName =
"DockPositionChanged"
;
UpdatePanel1.Triggers.Add(saveStateTrigger);
saveStateTrigger =
new
AsyncPostBackTrigger();
saveStateTrigger.ControlID = dock.ID;
saveStateTrigger.EventName =
"Command"
;
UpdatePanel1.Triggers.Add(saveStateTrigger);
}
private
void
LoadContent(RadDock dock)
{
switch
(dock.Tag)
{
case
"Cat 5e Capacity"
:
System.Web.UI.Control ctrl = Page.LoadControl(
"PowerUsage.ascx"
);
dock.ContentContainer.Controls.Add(ctrl);
break
;
}
}
RadDockLayout1_SaveDockLayout, LoadDockLayout, CurrentDockStates, CreateRadDockFromState are identical to those given in your examples. I believe the above should all be mostly identical, if not identical, as well.
The only difference I can see between my example and http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx is that my example does not use a 2nd UpdatePanel. Instead, I am using the RadAjaxManager to refresh the view after a user has drag/dropped/created a dock.
Does this seem correct? Can I provide more information?
Sean
EDIT: I see why the state of the graph reverts to its top level view. During page_init all the docks call LoadContent again to, in theory, reload the content they were displaying before. In practice, a user has navigated one level deep into the chart and then LoadContent is called -- this retrieves the top level of the chart, not one level deep. Any advice on how to handle this scenario would be much appreciated -- I do not see a great way of handling this.