Hi Telerik,
I have a RadMultiPage created at design time. I add page views to it programatically. When I add just one page view to the RadMultiPage -- all is well. I am able to refresh the page, work with the page, etc etc. Everything is fine.
When I add a second PageView to the page I see the height of the page views awkwardly restricted.
I have ViewState disabled. I regenerate the controls in Page_Initialization. Here are all the relevant methods. Do note that I played around with this a fair bit, and am confident I am regenerating the controls properly... I realize that I am breaking the "Regenerate Tabs and PageViews when NOT postback), but because I have ViewState disabled this should not be the case.
Here is the code where I allow the user to create a new RadPageView dynamically. This is located inside of an event after the page has been rendered fully.
SetupBase isn't relevant to the issue. I can confirm that the issue arises SOLEY on when I regenerate the second page view.
This method is called in Page_Load:
Here I recreate the pageView with the same ID as was known before and re-add it to the MultiPage. The MultiPage does not know of this PageView, nor does it seem to retain any information from the old page state once I step into Page_Init (my fear of regenning in page_load).
I also call this method in Page_Load. It handles the corner-case of 'first time load' where there are no page views to regenerate. As such, I create the first one and save it off so that when the user refreshes the page it is regenerated instead of created anew.
Okay, so this is a bulk of code, but basically all it says is "If there is no PageView, create our initial and save it."
This works well. I am able to create the initial PageView, it is the proper height. I am able to refresh the page and it retains its height information. If I close my page, reopen it, it still retains the correct height. I am confident that this is working for 1-pageview multipages.
I have attached two images which highlight my issue with accompanying HTML mark-up.
Is this a common issue? Thanks.
Sean
I have a RadMultiPage created at design time. I add page views to it programatically. When I add just one page view to the RadMultiPage -- all is well. I am able to refresh the page, work with the page, etc etc. Everything is fine.
When I add a second PageView to the page I see the height of the page views awkwardly restricted.
I have ViewState disabled. I regenerate the controls in Page_Initialization. Here are all the relevant methods. Do note that I played around with this a fair bit, and am confident I am regenerating the controls properly... I realize that I am breaking the "Regenerate Tabs and PageViews when NOT postback), but because I have ViewState disabled this should not be the case.
Here is the code where I allow the user to create a new RadPageView dynamically. This is located inside of an event after the page has been rendered fully.
CormantRadPageView pageView = CreateLayoutForNewTab();
newTab.PageViewID = pageView.ID;private
CormantRadPageView CreateLayoutForNewTab()
{
CormantRadPageView pageView =
new
CormantRadPageView();
LayoutManager.Instance.MultiPage.PageViews.Add(pageView);
StateManager.Save(pageView);
return
pageView;
}
public
CormantRadPageView()
{
ID =
string
.Format(
"RadPageView_{0}"
, Guid.NewGuid().ToString().Replace(
'-'
,
'a'
));
SetupBase();
LayoutManager.Instance.RegisteredPageViews.Add(
this
);
}
SetupBase isn't relevant to the issue. I can confirm that the issue arises SOLEY on when I regenerate the second page view.
This method is called in Page_Load:
public
void
RegeneratePageViews()
{
foreach
(var pageViewState
in
StateManager.GetStates<SerializableDictionary<
string
, RadPageViewSetting>>())
{
try
{
RadPageViewSetting pageViewSetting = pageViewState.Value;
CormantRadPageView pageView =
new
CormantRadPageView(pageViewSetting);
LayoutManager.Instance.MultiPage.PageViews.Add(pageView);
}
catch
(Exception exception)
{
_logger.ErrorFormat(
"Error regenerating page views. Reason: {0}"
, exception.Message);
throw
;
}
}
}
Here I recreate the pageView with the same ID as was known before and re-add it to the MultiPage. The MultiPage does not know of this PageView, nor does it seem to retain any information from the old page state once I step into Page_Init (my fear of regenning in page_load).
I also call this method in Page_Load. It handles the corner-case of 'first time load' where there are no page views to regenerate. As such, I create the first one and save it off so that when the user refreshes the page it is regenerated instead of created anew.
public
void
RegeneratePageState()
{
if
(StateManager.GetStates<SerializableDictionary<
string
, RadPaneSetting>>().Any())
{
List<CormantRadPageView> pageViews = LayoutManager.Instance.MultiPage.PageViews.OfType<CormantRadPageView>().ToList();
foreach
(CormantRadPageView pageView
in
pageViews)
{
RegenerateSplitterChildren(pageView.Splitter);
}
}
else
{
//We are now creating the dashboard for the first time, so 'regenerate' to the default state.
CormantRadPageView pageView =
new
CormantRadPageView();
LayoutManager.Instance.MultiPage.PageViews.Add(pageView);
CormantRadPane pane =
new
CormantRadPane { BackColor = Color.White };
StyledUpdatePanel updatePanel = pane.CreateUpdatePanel();
CormantRadSplitter radSplitter =
new
CormantRadSplitter { Visible =
false
};
CormantRadDockZone dockZone =
new
CormantRadDockZone();
updatePanel.ContentTemplateContainer.Controls.Add(radSplitter);
updatePanel.ContentTemplateContainer.Controls.Add(dockZone);
pane.Controls.Add(updatePanel);
pageView.Splitter.Controls.Add(pane);
StateManager.Save(radSplitter);
StateManager.Save(pageView);
}
RegenerateDockZones();
RegenerateDocks();
}
Okay, so this is a bulk of code, but basically all it says is "If there is no PageView, create our initial and save it."
This works well. I am able to create the initial PageView, it is the proper height. I am able to refresh the page and it retains its height information. If I close my page, reopen it, it still retains the correct height. I am confident that this is working for 1-pageview multipages.
I have attached two images which highlight my issue with accompanying HTML mark-up.
Is this a common issue? Thanks.
Sean