p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 (http://p2p.wrox.com/book-professional-asp-net-2-0-design-css-themes-master-pages-isbn-978-0-470-12448-2-349/)
-   -   Cannot convert type 'System.Web.UI.Page' to MasterPage' (http://p2p.wrox.com/book-professional-asp-net-2-0-design-css-themes-master-pages-isbn-978-0-470-12448-2/85050-cannot-convert-type-system-web-ui-page-masterpage.html)

zhshqzyc September 14th, 2011 04:59 PM

Cannot convert type 'System.Web.UI.Page' to MasterPage'
 
In chapter 7, page 239.
I tried the code below in Visual Studio 2008
Code:


using
System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
publicpartialclass_Default : System.Web.UI.Page
{
protectedvoid Page_PreInit(object sender, EventArgs e)
{
Page.MasterPageFile = "~/MasterPage.master";
}
protectedvoid Page_Load(object sender, EventArgs e)
{
MasterPage mp = (MasterPage)Page.Master;
mpLabel.Text = Master.myValue;
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
TextBox1.Text = "";
}
}

But there is an error
Code:

Cannot convert type 'System.Web.UI.Page' to MasterPage'
Thanks for help.


All times are GMT -4. The time now is 04:32 PM.

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.