Master Page Source Code
<%@ 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></title>
<link href="Styles/MainClass.css" rel="Stylesheet" type="text/css" />
<%-- <style type="text/css">
.style1
{
width: 100%;
height: 526px;
}
.style2
{
width: 199px;
}
</style>--%>
</head>
<body>
<form id="form1" runat="server">
<table >
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="btnsave" runat="server" Text="Save" />
<br />
<asp:Button ID="Button1" runat="server" Text="Delete" />
</td>
<td>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Image/utilities.jpg" CssClass="masterpageMiddleheaderimage"/>
</td>
</tr>
<tr>
<td class="masterleftwhite"></td>
<td>
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal"
CssClass="menulist" BorderStyle="Inset" BorderWidth="1px"
ForeColor="#FF9966" Height="12px" RenderingMode="List" >
<Items>
<asp:MenuItem Text="Satya" Value="Satya" ></asp:MenuItem>
<asp:MenuItem Text="Linku" Value="Linku"></asp:MenuItem>
<asp:MenuItem Text="Hari" Value="Hari"></asp:MenuItem>
</Items>
</asp:Menu>
</td>
</tr>
<tr>
<td >
<asp:Panel ID="Panel1" runat="server" CssClass="masterpageleftdownimage">
<asp:LinkButton ID="LinkButton1" runat="server" Text="Satya"/>
<asp:LinkButton ID="LinkButton2" runat="server" Text="Satya"/>
<asp:LinkButton ID="LinkButton3" runat="server" Text="Satya"/>
</asp:Panel>
</td>
<td>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>
Master Page C# Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
//Add This Properties//
public Button Save
{
get
{
return btnsave;
}
}
}
Child Page Source Code
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="addMasterpage.aspx.cs" Inherits="addMasterpage" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="InnerContent3WOI">
<div class="labeldiv">
Roll
</div>
<div class="valuediv">
<asp:TextBox ID="toll" runat="server" />
</div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</asp:Content>
Child Page C# Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class addMasterpage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Master.Save.Click += save;
}
protected void save(object sender, EventArgs e)
{
Label1.Text = "Hello DotNet Devlopers";
}
}
<%@ 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></title>
<link href="Styles/MainClass.css" rel="Stylesheet" type="text/css" />
<%-- <style type="text/css">
.style1
{
width: 100%;
height: 526px;
}
.style2
{
width: 199px;
}
</style>--%>
</head>
<body>
<form id="form1" runat="server">
<table >
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="btnsave" runat="server" Text="Save" />
<br />
<asp:Button ID="Button1" runat="server" Text="Delete" />
</td>
<td>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Image/utilities.jpg" CssClass="masterpageMiddleheaderimage"/>
</td>
</tr>
<tr>
<td class="masterleftwhite"></td>
<td>
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal"
CssClass="menulist" BorderStyle="Inset" BorderWidth="1px"
ForeColor="#FF9966" Height="12px" RenderingMode="List" >
<Items>
<asp:MenuItem Text="Satya" Value="Satya" ></asp:MenuItem>
<asp:MenuItem Text="Linku" Value="Linku"></asp:MenuItem>
<asp:MenuItem Text="Hari" Value="Hari"></asp:MenuItem>
</Items>
</asp:Menu>
</td>
</tr>
<tr>
<td >
<asp:Panel ID="Panel1" runat="server" CssClass="masterpageleftdownimage">
<asp:LinkButton ID="LinkButton1" runat="server" Text="Satya"/>
<asp:LinkButton ID="LinkButton2" runat="server" Text="Satya"/>
<asp:LinkButton ID="LinkButton3" runat="server" Text="Satya"/>
</asp:Panel>
</td>
<td>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>
Master Page C# Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
//Add This Properties//
public Button Save
{
get
{
return btnsave;
}
}
}
Child Page Source Code
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="addMasterpage.aspx.cs" Inherits="addMasterpage" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="InnerContent3WOI">
<div class="labeldiv">
Roll
</div>
<div class="valuediv">
<asp:TextBox ID="toll" runat="server" />
</div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</asp:Content>
Child Page C# Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class addMasterpage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Master.Save.Click += save;
}
protected void save(object sender, EventArgs e)
{
Label1.Text = "Hello DotNet Devlopers";
}
}
No comments:
Post a Comment