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

Error sizing height of PageView only when multiple PageViews exist.

4 Answers 53 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 2
Sean asked on 12 Aug 2011, 08:35 PM
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.
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

4 Answers, 1 is accepted

Sort by
0
Sean
Top achievements
Rank 2
answered on 17 Aug 2011, 12:54 AM
Spent some more time looking into this and I've got some more thoughts on the matter. Not sure if they're right or not, but hey, information is helpful.

So, a few things:

  • I've wrapped my RadMultiPage in a conditional update panel. When the user adds a new RadTab & RadPageView to the page I call Update to reflect their changes. It is worth nothing that when I do this all controls work as expected. I am able to use additional tabs freely. The error still remains upon refreshing the page, however.
  • I captured the source of the page after this UpdatePanel updates (but before I perform a full-page refresh) and again after the full page refresh.  Before Refresh After Refresh. I ran them through a diff, but the results were surprisingly boring. Nothing except the unique IDs of the CSS change in the source between the callback and the full postback.

I think the problem stems from the fact that the PageView's nearest child is a Splitter with height 100%, but I do not understand why I do not experience problems with just one tab and page view on my page. Adding 3+ page views does not compound the problem, either. Two page views causes the issue, three looks no different than two. I thought that perhaps there was hidden mark-up being generated, wrapping the controls, and causing the splitter's height 100% to fail, but the diff seems to indicate that is not, in fact, occurring. 

I'd also like to head off the obvious answer of "Regenerate Page Views in Page_Init" with "Why and How?" I have controls which need to be re-added to the page during Page_Init. These controls need to have a parent control to attach to... the page view. As such, I believe I need to regenerate Page Views in Page_Init.

Thanks for your time.

Sean
0
Peter
Telerik team
answered on 18 Aug 2011, 02:19 PM
Hello Sean,

I am sorry for the delay.

We weren't able to replicate the problem locally. Can you isolate the issue in a simple working demo and send it to us via a support ticket.

All the best, Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Sean
Top achievements
Rank 2
answered on 18 Aug 2011, 03:39 PM
I was anticipating this. :) I've sent it forward to Dobromir. Thanks for looking at it.
0
Peter
Telerik team
answered on 19 Aug 2011, 07:28 AM
Hello Sean,

Thank you.

Doboromir just notified me that he has received the project. So we will work together with him and follow up in the ticket as soon as we resolve the problem.

Best wishes,
Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
TabStrip
Asked by
Sean
Top achievements
Rank 2
Answers by
Sean
Top achievements
Rank 2
Peter
Telerik team
Share this question
or