Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 4th, 2008, 07:28 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AspNetGuy
Default ASP Wizard on Master Page

When I take a very simple example of a Wizard control which works on a non-master page and move the control to a page using a master page it cesases to work as follows:

If I have three steps, I can click the NEXT button on step 1 and move to STEP2. When I click on the NEXT button on the step 2 page the control remains on the current page.

If I click the PREVIOUS button on page 2 I get the following message:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorExceptio n: The command 'MovePrevious' is not valid for the previous step, make sure the step type is not changed between postbacks.


My master page is effectively the same as from Beginning ASP 3.5.

Any help would be greatly appreciated.

I have seen several references on the web to this message but no one has proposed a solution other than looking at the code behind file.

For this page there is no code in the code behind file. The BasePage code follows:

using System;
using System.Web;


/// <summary>
/// Summary description for BasePage
/// </summary>
public class BasePage : System.Web.UI.Page
{
    private void Page_PreRender(object sender, EventArgs e)
    {
        if (this.Title == "Untitled Page")
        {
            throw new Exception("Page title cannot be \"Untitled Page\".");
        }

    }
    private void Page_PreInit(object sender, EventArgs e)
    {
        HttpCookie preferredTheme = Request.Cookies.Get("PreferredTheme");


        /* Obtain the URL.Segments for the current page*/
        string[] segments = Request.Url.Segments;

        /*--------------------------------------------------------------------*/
        /* Loop through the segments looking for "Security/". If found then */
        /* the user is requesting a page from the Security directory. We will*/
        /* always use the "Security" theme for those pages. */
        /*--------------------------------------------------------------------*/
        int i = 0;
        while (i < segments.Length && !segments[i].Equals("Security/"))
        {
            i++;
        }
        if (i < segments.Length)
        {
            Page.Theme = "Security";
            //if (preferredTheme != null)
            //{
            // preferredTheme.Value = "Security";
            //}
        }
        else
        {
           // if (preferredTheme != null)
           // {
               // if (preferredTheme.Value == "DarkGrey")
               // {
               // preferredTheme.Value = "TFL";
               // }
               Page.Theme = "TFL";
           // }
        }

    }
    public BasePage()
    {
        this.PreRender += new EventHandler(Page_PreRender);
        this.PreInit += new EventHandler(Page_PreInit);
    }
}


  #2 (permalink)  
Old June 4th, 2008, 09:19 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AspNetGuy
Default

I have an update to this problem. If I create a new master page with no code in the code behind file the control works.

So it must be something in the code I posted earlier in the BasePage class.

  #3 (permalink)  
Old June 4th, 2008, 09:34 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AspNetGuy
Default

Ok I solved this problem. I don't understand why this one line of code broke the Wizard control and I certainly don't know why commenting it out fixes it, but it does.

In my base class (BasePage) for the master page I am suing I have the following code:

protected void Page_Load(object sender, EventArgs e)
    {
        /* We do this to stabilize the prefix on IDs in the page. Now all IDs will */
        /* always start with "swdMaster". */
        this.ID = "swdMaster";
    }


If I comment out that line of code my Wizard control works. IF I leave it in I get the results previously posted.

I hope this helps anyone else experiencing the problem.

  #4 (permalink)  
Old June 5th, 2008, 09:19 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The error message you posted has to do with the AJAX framework, not so much with master pages. So I imagine that the problem with your line of code has to do with the way page callbacks are handled. Perhaps try setting a breakpoint on that line of code and see in what cases it gets called. Perhaps it's not getting called on an AJAX callback, although I don't see why that would be.

-Peter
compiledthoughts.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Master Page in ASp.net 2.0 dilipv .NET Framework 2.0 1 March 4th, 2008 07:00 AM
VS2008 Master page error in <asp:contentPlaceHolde JesseTutterrow ASP.NET 2.0 Basics 1 December 10th, 2007 12:17 PM
ASP.NET and Master Page ayazhoda ASP.NET 2.0 Basics 5 May 14th, 2007 04:22 PM
JScripts on ASP.NET Master page? woojtii Javascript How-To 0 March 28th, 2007 05:54 AM
Asp (master-)detail's page future's records viewin karib Classic ASP Databases 15 March 23rd, 2004 02:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.