Welcome Guest Search | Active Topics | Sign In | Register

Invalid Page ID on Click of Dynamically Added PageView Options
EverMan
Posted: Friday, November 15, 2019 2:51:04 PM
Rank: Newbie
Groups: Member

Joined: 9/8/2010
Posts: 2
I have an implementation of a MultiPage where in one of the PageViews, we create a tabstrip and multipage dynamically.

So, a server-side event (triggered by dropdown selection), adds tabitems and pageview items to a linked tabstrip and multipage.

It works, well sort of...
The items are added and visible after the event fires and the page is rendered.

I can click on the new tabs and I do see the new page associated. I also see it when viewing the source. What happens though after I click is get this error. I presume it is client side, but maybe not? If it is a postback, I am not reaching the Page_Load. Here's the error. PageView2 is one of my dynamically added pages. Again, I can see it is there.


Invalid page ID 'PageView2'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Invalid page ID 'PageView2'.

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:



[HttpException (0x80004005): Invalid page ID 'PageView2'.]
EO.Web.MultiPage.a(String A_0, Boolean A_1) +377
EO.Web.TabStrip.a(TabItem A_0, Boolean A_1) +334
EO.Web.TabItem.a(TabItem A_0, Boolean A_1) +224
EO.Web.TabItem.a(ij A_0, Boolean A_1) +66
EO.Web.NavigationItem.b(ij A_0, Boolean A_1) +107
EO.Web.NavigationItem.set_Selected(Boolean value) +17
EO.Web.Internal.q.a(ks A_0) +1807
EO.Web.Internal.cf.ac() +173
EO.Web.WebControlBase.LoadViewState(Object savedState) +74
EO.Web.BaseNavigator.b(Object A_0) +13
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +183
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
System.Web.UI.Page.LoadAllState() +312
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1661


eo_support
Posted: Friday, November 15, 2019 3:10:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,200
Hi,

This is a common error when you create controls dynamically. For many features of ASP.NET to work properly, the control tree during the initial rendering stage and the post back stage must be exactly the same. This usually is not a problem when you do not create controls dynamically because in that case the control tree is always built from the same .aspx file thus they are always identical.

When you create controls dynamically, you must not break this rule. In another word, you must recreate all the controls exactly the same way that you previously dynamically created when you page is posting back. So if you initially have created "PageView2", then you must recreate this control and put it in exactly the same location in the control tree as it was originally created. You should do this at the very early stage of the page's life cycle (such as Page_Init event) so that later stages (such as LoadViewState) that rely on the control tree would function properly. There are no fixed/standard way to implement this and you can search online for more information on this topic. We consider this a general ASP.NET programming issue so we only point you to the right direction, but do not provide detailed support on such issues.

We also noticed that your license was purchased many years ago. We provide free tech support for one year for all orders. So the tech support period for your order has in fact expired a long time ago. So if you wish to continue to receive tech support, you would need to purchase a new license.

Thanks!
EverMan
Posted: Monday, November 18, 2019 11:33:34 AM
Rank: Newbie
Groups: Member

Joined: 9/8/2010
Posts: 2
Hello eo_support,

The controls are, in fact, being added as a result of another control's event firing. What's interesting is when I code it so that those dynamically added controls are created in the PreInit, I end up with duplicate tabs, but the right # of pageviews. I checked both and EnableViewState was turned on. It appears the viewstate is there for the tabitems but not the pageviews. I'm guessing I'm not doing something correctly. In the meantime, I've disabled EnableViewState on the tabstrip and it is no longer giving me the error.

As for the license, I'm doing this for a client, in their environment, and it is their licensing - not mine. I'll check with them to see if they are up to date. Thank you.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.