Addition of Two Nos using Asp Controls with Master Page
Ans:-
MasterPage.master:-
<%@ 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 id="Head1" runat="server">
<title>Master Page</title>
</head>
<body>
<form id="form1" runat="server">
<%-- <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>--%>
<div>
<%-- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>--%>
<table>
<tr>
<td width='100px' height='75px'><img src="Images/Water%20lilies.jpg" width='100px' height='75px' /></td>
<td colspan='2' width='1000px' height='75px'><img src="Images/Sunset.jpg" width='1000px' height='75px' /></td>
</tr>
<tr>
<td width='100px' height='600px' align="center">
<asp:ContentPlaceHolder id="head" runat="server">
This is for left side content place holder
</asp:ContentPlaceHolder>
</td>
<td width='900px' height='600px' align="center">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
This is for center content place holder
</asp:ContentPlaceHolder>
</td>
<td width='100px' height='600px' align="center"><img src="Images/Winter.jpg" width='100px' height='600px' /></td>
</tr>
<tr>
<td colspan='2' width='1000px' height='50px'><img src="Images/Blue%20hills.jpg" width='1000px' height='50px' /></td>
<td width='100px' height='50px'><img src="Images/Water%20lilies.jpg" width='100px' height='50px' /></td>
</tr>
</table>
<%-- </ContentTemplate>
</asp:UpdatePanel>--%>
<div align="center" width='1100px' height='25px'>Copy Right-2014 @ Acess Meditech Pvt.Ltd. </div>
</div>
</form>
</body>
</html>
Ans:-
MasterPage.master:-
<%@ 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 id="Head1" runat="server">
<title>Master Page</title>
</head>
<body>
<form id="form1" runat="server">
<%-- <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>--%>
<div>
<%-- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>--%>
<table>
<tr>
<td width='100px' height='75px'><img src="Images/Water%20lilies.jpg" width='100px' height='75px' /></td>
<td colspan='2' width='1000px' height='75px'><img src="Images/Sunset.jpg" width='1000px' height='75px' /></td>
</tr>
<tr>
<td width='100px' height='600px' align="center">
<asp:ContentPlaceHolder id="head" runat="server">
This is for left side content place holder
</asp:ContentPlaceHolder>
</td>
<td width='900px' height='600px' align="center">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
This is for center content place holder
</asp:ContentPlaceHolder>
</td>
<td width='100px' height='600px' align="center"><img src="Images/Winter.jpg" width='100px' height='600px' /></td>
</tr>
<tr>
<td colspan='2' width='1000px' height='50px'><img src="Images/Blue%20hills.jpg" width='1000px' height='50px' /></td>
<td width='100px' height='50px'><img src="Images/Water%20lilies.jpg" width='100px' height='50px' /></td>
</tr>
</table>
<%-- </ContentTemplate>
</asp:UpdatePanel>--%>
<div align="center" width='1100px' height='25px'>Copy Right-2014 @ Acess Meditech Pvt.Ltd. </div>
</div>
</form>
</body>
</html>
AddWthMaterPageContent.aspx:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddWthMaterPageContent.aspx.cs" Inherits="_Default" MasterPageFile="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div>Addition of Two Nos using Asp Controls with Master Page</div>
<div>
<script type="text/javascript" language="javascript">
function Addition(val) {
var num1 = parseInt(document.getElementById("<%=txtSal.ClientID %>").value);
var num2 = parseInt(document.getElementById("<%=txtComm.ClientID %>").value);
var result = num1 + num2;
document.getElementById("<%=txtTotSal.ClientID %>").value = result;
}
</script>
<center>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table>
<tr><td colspan='3' align="center"><b>Get Individual Employee Details</b></td></tr>
<tr><td>Sal</td><td>:</td><td><asp:TextBox ID="txtSal" onkeyup="Addition(1)" value="0" runat="server"></asp:TextBox></td></tr>
<tr><td>Commission</td><td>:</td><td><asp:TextBox ID="txtComm" onkeyup="Addition(2)" value="0" runat="server"></asp:TextBox></td></tr>
<tr><td>Total Salary</td><td>:</td><td><asp:TextBox ID="txtTotSal" onkeyup="Addition(3)" value="0" runat="server"></asp:TextBox></td></tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</center>
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
Left-Side Content
</asp:Content>
No comments:
Post a Comment