Navigate between multiple Wisej.Web.Page obejcts

0
0

Hi,

in our project we have multiple pages of  type Wisej.Web.Page, e.g. for orders, customers, carriers, and we handle them in a List<Wisej.Web.Page>

called PageCol , add new pages to that list and handle the navigation between these pages in a static class with methods like this:

 

public static List<Wisej.Web.Page> PageColl;

public static void Forward(Wisej.Web.Page page)

{

bool added = false;

      foreach (Wisej.Web.Page item in PageColl)

{      

         if (item.Tag.ToString() == page.Tag.ToString())

{

            added = true;

            break;

}

}

    if (!added)

{

PageColl.Add(page);

Page.Show();

}

}

It all works fine for one user, but as soon as a second user works with the page the whole navigation of the pages will crush, as it appears that all users work with the same  list of pages. Looks like we can’t use the static class to handle the different pages for multiple users so I would like to ask  if you have any idea to solve that problem or maybe have an even better approach for the whole navigation of multiple Wisej.Web.Pages.

 

Greets,

Marcel

  • You must to post comments
0
0

Hi Marcel,

“static” members are shared to all sessions/users/etc. This is an interesting feature when you want a simple way to share information or to “inject” information (information that was made available outside of the current session, say another user sent you a message, or a WebService inserted a new invoice to validate on your work queue).

If you need static objects that are intended to be used only by a given session, you should use session variables. Please have a look at Using the Session Object

  • You must to post comments
0
0

To navigate difference pages you only need to call page1.Show(), page2.Show(), etc. The last page (Wisej.Web.Page) shown will always be the main page (Application.MainPage). To create and show a page you can:

new Page10().Show();

No need to save it to the session. All top level windows and pages in Wisej are referenced respectively in Application.OpenForms and Application.OpenPages. You can use either a numeric indexer or the name of the page. If you use the name, the code above would be:

new Page10() {Name = “Page Ten”} .Show();

You can navigate back to Page10:

Application.OpenPages[“Page Ten”].Show();

HTH

 

  • You must to post comments
0
0

Thanks for the answer. We changed the navigation class from static to dynamic and put the object into a session variable as suggested and now multiple users can work with the page at the same time.

Do you have any other idea how to handle multiple Wisej.Web.Pages and the navigation between these pages, because our approach appears to us a bit clumsy. We already “combed the desert” and ain’t found nothing better, yet.

 

Greets,

Marcel

  • You must to post comments
0
0

BTW, marking a static variable as ThreadStatic isn’t an option. I did the test and although different browsers on different computers were showing different session IDs, sometimes the ThreadStatic static variable was showing the same value.

As Scott Hanselman puts it, in ASP.NET you don’t control the thread life…you inherit a worker thread.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.