Sunday, January 17, 2010

DataBinding to single value:



HTML VIEW:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!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>
<form id="form1" runat="server">
<asp:Label ID="CustomerIDLabel" runat="server" Style="z-index: 100; left: 6px; position: relative;
top: 0px" Text="Customer ID"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Style="z-index: 101; left: 58px; position: relative;
top: 1px"></asp:TextBox>
&nbsp; &nbsp; &nbsp; &nbsp;
<br />
<asp:Label ID="OrderIDLabel" runat="server" Style="z-index: 102; left: 7px; position: relative;
top: 11px" Text="Order ID"></asp:Label>
<asp:TextBox ID="OrderIDBox" runat="server" Style="z-index: 103; left: 81px; position: relative;
top: 15px"></asp:TextBox>
<asp:Label ID="OrderDateLabel" runat="server" Style="z-index: 104; left: 21px; position: absolute;
top: 94px" Text="Order Date"></asp:Label>
<asp:TextBox ID="OrderDateBox" Text="<%#OrderDate %>" runat="server" Style="z-index: 105; left: 153px; position: absolute;
top: 95px"></asp:TextBox>
<asp:TextBox ID="ProductNameBox" runat="server" Style="z-index: 106; left: 156px;
position: absolute; top: 136px"></asp:TextBox>
<asp:TextBox ID="QuantityBox" Text="<%#val(QuantityBox.text)* val(PriceBox.text)-((val(DiscountLabel.Text)/100)*(val(QuantityBox.text)*val(PriceBox.Text))) %>" runat="server" Style="z-index: 107; left: 160px; position: absolute;
top: 175px"></asp:TextBox>
&nbsp;
<asp:TextBox ID="PriceBox" runat="server" Style="z-index: 108; left: 160px; position: absolute;
top: 216px"></asp:TextBox>
<asp:Label ID="Label4" runat="server" Style="z-index: 109; left: 21px; position: absolute;
top: 139px" Text="Product Name"></asp:Label>
<asp:Label ID="QuantityLabel" runat="server" Style="z-index: 110; left: 24px; position: absolute;
top: 178px" Text="Quantity"></asp:Label>
&nbsp;
<asp:Label ID="PriceLabel" runat="server" Style="z-index: 111; left: 29px; position: absolute;
top: 223px" Text="Price"></asp:Label>
<asp:Label ID="AmountLabel" runat="server" Style="z-index: 112; left: 33px; position: absolute;
top: 258px" Text="Amount"></asp:Label>
<asp:Label ID="MessageLabel" runat="server" Text='<%# "The Product you entered is:" + ProductNameBox.Text %>' Visible="False" Style="z-index: 113; left: 152px; position: absolute;
top: 338px" Width="226px"></asp:Label>
&nbsp; &nbsp;
<asp:Button ID="AmtButton" runat="server" Style="z-index: 120; left: 352px; position: absolute;
top: 219px" Text="Calculate Amount" />
<asp:TextBox ID="AmountBox" Text="<%#(val(QuantityBox.text)* val(PriceBox.Text))-((val(DiscountLabel.Text)/100)* (val(QuantityBox.Text)*val(PriceBox.Text))) %>" runat="server" Style="z-index: 117; left: 162px; position: absolute;
top: 252px"></asp:TextBox>
<asp:Button ID="SubmitButton" runat="server" Style="z-index: 118; left: 212px; position: absolute;
top: 298px" Text="Submit" />
<asp:Button ID="DiscountButton" runat="server" Style="z-index: 119; left: 344px;
position: absolute; top: 176px" Text="Calculate Discount" />
&nbsp;<asp:Label ID="DiscountLabel" Text="<%#CalculateDiscount%>" runat="server" Style="left: 71px; position: relative;
top: 93px" >Discount</asp:Label>
</form>
</body>
</html>

No comments:

Post a Comment