Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MessageDisplay.aspx Does Not Work with Master Page
Message
From
14/11/2008 19:19:07
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
14/11/2008 13:32:18
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01361971
Message ID:
01362038
Views:
19
Hi Al,

>I am trying to use MessageDisplay.aspx to present a user friendly message to the user when an exception occurs. It works fine until I changed MessageDisplay.aspx to use a Master Page. I thought that would be a reasonable thing to do.
>
>The first problem I had was with the following code in mmMessageDisplay.DisplayPage():
>
> this.DisplayPage((Label)this.FindControl("lblHeader"),
> (Label)this.FindControl("lblMessage"),
> (Label)this.FindControl("lblRedirectHyperLink"));
>
>This was not finding the controls because of the Master Page. I changed the code to the following, which now works okay:
>
> this.DisplayPage((Label)this.Master.FindControl("MainContent").FindControl("lblHeader"),
> (Label)this.Master.FindControl("MainContent").FindControl("lblMessage"),
> (Label)this.Master.FindControl("MainContent").FindControl("lblRedirectHyperLink"));
>
>Once I got past the above issue, I ran into another problem that I am really struggling to resolve. I now get an exception saying “A page can have only one server-side Form tag.”
>
>If I run the same test with debugging, I get an exception saying "Error executing child request for /LendRite/MessageDisplay.aspx." This exception occurs on the following line in mmMessageDisplay.DisplayMessage():
>
>Context.Server.Transfer(mmWebDataHelper.GetFilePath("/" + templatePageName));
>
>As always, any help would be appreciated.
>
>Thanks,
>
>Al

I can see why you might want to do this. I just looked at a couple of my web projects and see I have created a new Message page with a master but the old one is still around also. If I get a chance this weekend I will look at that and see what I did more specific. I am curious about the code you changed above and wondering why you have to call FindControl on the master to get to them. Also, the only one form tag is correct you will need to limit yourself to only what is allowed inside the content holder. You may not have removed enough of the outer tags that no longer apply. Take a look at one of your pages that alreay use a master.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform