Home > .Net > Nested Master pages image showing problem in webpages

Nested Master pages image showing problem in webpages

Today I am handling Master and Nester master first time I found it very useful. I am having pay for someone to write your essay problem in showing master page images in my content web pages.

I need to set two things this;

  1. Make all image as runat=”server”
  2. Image src path should be give with Tilda sign “~” for e.g src=”~/images/HeaderAdmin.jpg”

In my senario my Main master page “MainMP.master” and admin site master page is “AdminMP.master” on root folder of website whereas content web pages of Admin side are in a sub folder “root\Admin\pagename.aspx”.

An e.g is below and important things are in bold;

Main Master Page

<%@ Master Language=”C#” AutoEventWireup=”true” CodeFile=”MainMP.master.cs” Inherits=”Main” %>

<!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>ProGold Network</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<table width=”100%”>
<tr>
<td colspan=”3″>
<img id=”imgHeader” alt=” Hi Master and Nester Master Page testing” src=”~/images/HeaderAdmin.jpg” runat=”server” />
</td>
</tr>
<tr>
<td colspan=”3″>
<asp:ContentPlaceHolder ID=”MainContent” runat=”server”>
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td>
Footer
</td>
<td style=”text-align: right;”>
<img src=”~/images/bbb.jpg” runat=”server” alt=”" width=”56″ height=”54″ />
<img src=”~/images/verisign.jpg” runat=”server” alt=”" width=”77″ height=”57″ />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Nested Master Page

<%@ Master Language=”C#” MasterPageFile=”~/MainMP.master” AutoEventWireup=”true” CodeFile=”AdminMP.master.cs”  Inherits=”Admin_AdminMP” %>

<asp:Content ID=”Content2″ ContentPlaceHolderID=”MainContent” runat=”Server”>
<tr>
<td>
<table>
<tr>
<td colspan=”10″ align=”center”>
Search FedEx No.:
<asp:TextBox runat=”server” ID=”TextBox2″></asp:TextBox>
&nbsp;
<asp:Button runat=”server” Text=”Search” ID=”Button2″></asp:Button>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:ContentPlaceHolder ID=”PageContent” runat=”server”>
</asp:ContentPlaceHolder>
</td>
</tr>
</asp:Content>

Content WebPage

<asp:Content ID=”Content2″ ContentPlaceHolderID=”PageContent” runat=”Server”>
<table width=”100%”>
<tr>
<td>
<asp:Label ID=”lblMsg” runat=”server” Text=”"></asp:Label>
</td>
</tr>
</table>
</asp:Content>

Comments are closed.

TOP