Learning ASP.NET 2.0 - Having trouble creating master page

D

Dave

It seems that if I put just html inside a master page, everything
works fine. But if I put other controls (such as WebControls and/or my
own custom controls), I can't seem to access the content area in the
designer (on the master page or the content page that uses the master
page). The designer is just greyed out completely. It does seem to
work at runttime, but this is a problem for usability. I must be doing
something wrong.

Here's a simple example that I've tried and couldn't get to work:

If I put this in the master page it works fine:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="pm2.master.cs" Inherits="pm" %>
<%@ Register TagPrefix="CL" Namespace="CodeLib.Web.UI.WebControls"
Assembly="CodeLib.Web.UI.WebControls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="margin:0">
<form id="form1" runat="server">
<table>
<tr>
<td>
<asp:contentplaceholder id="contentMain" runat="server">
</asp:contentplaceholder>
</td>
</tr>
</table>
</form>
</body>
</html>

If I put this, it doesn't work:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="margin:0">
<form id="form1" runat="server">
<asp:Table runat="server" id="tblMain">
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:contentplaceholder id="contentMain" runat="server">
</asp:contentplaceholder>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>

NOTE: The only difference is one uses an HTML table and the other uses
a WebControl table.

Any help would be appreciated.
 
D

Dave

Hello David Wier,

Thanks for your reply. The main problem is that I can't seem to use
the Visual Studio designer for drag and dropping into the content
area. If you take this sample code and stick it into a master page,
you'll see what I mean:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="margin:0">
<form id="form1" runat="server">
<asp:Table runat="server" id="tblMain">
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:contentplaceholder id="contentMain" runat="server">
</asp:contentplaceholder>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>

Both the master page and webpage that uses this master page doesn't
allow you to use the page at design time. However, if you change the
table webcontrols to hmtl, it works fine...

Is there something i'm missing here? I'm using Visual Studio 2005 w/
c#.

Thanks,
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top