Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the following 'master page' code I am unable to show the Panel1 while running. No error comes but the screen is blank.
XML
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!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>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <asp:Panel ID="Panel1" runat="server" BackColor="Red" Width="1000" Height="300">
         </asp:Panel>
    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
Posted
Comments
Mas11 27-Nov-13 4:16am    
Hey drag some controls in panel then u'll see its visible or not.
S.Rajendran from Coimbatore 27-Nov-13 4:34am    
In design view it is appearing.
Karthik_Mahalingam 27-Nov-13 4:26am    
r u hiding the panel in code behind ?? check for it ??
S.Rajendran from Coimbatore 27-Nov-13 4:31am    
No I am not hiding in code behind
Karthik_Mahalingam 27-Nov-13 5:16am    
try creating in a fresh solution..

I have tried your html code it's working there is no problem.

See if you have mentioned anything in code behid or somewhere.
 
Share this answer
 
Comments
S.Rajendran from Coimbatore 27-Nov-13 4:41am    
This is my code behind:
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
S.Rajendran from Coimbatore 27-Nov-13 4:56am    
If I run, in the top bar it shows like- http://localhost:1045/WebSite1/ instead of http://localhost:1045/masterpage/
[no name] 27-Nov-13 4:59am    
Is your WebSite1 is running under master template
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="WebSite1.aspx.cs" Inherits="WebSite1" %>
S.Rajendran from Coimbatore 27-Nov-13 5:10am    
No not like above. It runs as per the code submitted by me. Meanwhile I deleted the 'Default.aspx' and again added freshly with the same name with a tick on 'select master page'
option. It works and the display on the top bar is like -http://localhost:1045/WebSite1/Default.aspx
Thanks. Is it correct, though it works. Is it the correct procedure?
[no name] 27-Nov-13 5:13am    
Yes good this is the right solution :)
I have tested your code it working...fine there is no problem in this code
 
Share this answer
 
You have to keep panel with in contentplaceholder :)
 
Share this answer
 
Comments
S.Rajendran from Coimbatore 27-Nov-13 4:50am    
It is not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900