Hi, all
I want help for the below mentioned problems. PLease give example with source code. Please help me.
1. I have made upto this point. Now i want the functionality that when i enter the item orderd and discount the amount column should be updated as per the
following formula.
amount = rate*item orderd - discount
2. As the amount column updated the sub total should be changed.
3. as the user enter the taxes the grand total should also be changed.
Regards
sp_412000@dotnet.itags.org.yahoo.com
<%@dotnet.itags.org. Import Namespace="System.Data" %>
<%@dotnet.itags.org. Import Namespace="System.Data.OleDb" %>
<script runat="server" language="C#">
void Page_Load(Object src,EventArgs e)
{
OleDbConnection dbConn =
new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=/studynet/Authors2k.mdb;User Id=admin;Password=;" );
OleDbDataAdapter dbAdap = new OleDbDataAdapter("SELECT item_id,item_name,unit,rate,stock FROM product",dbConn);
DataSet ds = new DataSet();
dbAdap.Fill(ds,"product");
rept.DataSource = ds.Tables["product"].DefaultView;
rept.DataBind();
}
</script>
<html>
<form id="form1" runat="server">
<asp:repeater id="rept" runat="server">
<HeaderTemplate>
<table>
<tr>
<th>Del</th>
<th>Item #</th>
<th>Name</th>
<th>Unit</th>
<th>Rate</th>
<th>Item Ordered</th>
<th>Discount</th>
<th>Amount</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox id="chk1" runat="server" />
</td>
<td>
<%# DataBinder.Eval(Container.DataItem,"item_id") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem,"item_name") %>
</td>
<td>
<#% DataBinder.Eval(Container.DataItem,"unit") %>
</td>
<td>
<#% DataBinder.Eval(Container.DataItem,"rate") %>
</td>
<td>
<asp:textbox id="txt1" runat="server" />
</td>
<td>
<asp:textbox id="txt2" runat="server" />
</td>
<td>
<asp:textbox id="txt3" runat="server" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:repeater>
sub total: <asp:textbox id="subtot" runat="server" />
Taxes: <asp:textbox id="taxes" runat="server" />
Grand Total: <asp:textbox id="gtot" runat="server" />
</form>
</html>
If you want it to be "automatic" then you would add a onchange eventfor the textboxes and have them do the approproate math when the textchanges
HTH
0 comments:
Post a Comment