<asp:GridView
AutoGenerateColumns="false"
ID="GridView1" runat="server" Style="position: relative" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="price" runat="server" Style="position: relative"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="num" runat="server" Style="position: relative"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="amt" runat="server" Style="position: relative"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
public partial class SettleMent_Income_test10 :
{
mybill = new ();
protected void Page_Load(object sender, EventArgs e)
{
if (!)
{
myBillQuery = new ();
DataSet ds = new DataSet();
(myBillQuery, ref ds);
this. = ds;
this.();
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ( == )
{
TextBox tbprice=([0].FindControl("price") as TextBox);
TextBox tbnum = ([1].FindControl("num") as TextBox);
TextBox tbamt = ([2].FindControl("amt") as TextBox);
if (tbprice != null && tbnum != null && tbamt != null)
{
if (!())
{
= "0";
}
if (!())
{
= "0";
}
= (() * ()).ToString();
StringBuilder script = new StringBuilder();
//输入数值之后总自动金额更新
(" var amount=0;");
(" vAmt=('" + + "');");
(" vNum=('" + + "');");
(" vPrice=('" + + "');");
("var amt=parseFloat()*parseFloat();");
("=amt;");
//只允许输入带小数的数字.
string scriptOnKeyPress=@"return /^[1-9]/d{9}/.test()?(//./.test()?(//./d{2}/.test
()?(==0):(>=48&&<=57)):(==46)):
(>=48&&<=57)";
("onblur", ());
("onkeypress", scriptOnKeyPress);
("onblur", ());
("onkeypress", scriptOnKeyPress);
}
}
}
}