其中,分数下面这个值来自TBox11 ,自动计算的合计值来自_41
现在分数这个值需要手动输入,怎么才能在“合计”算出来的时候,自动填入到分数框里?

前台代码如下:
<form id="form1" runat="server">
<div>
<table align="center" style="background-color: #ABFCB0">
<tr>
<td style="width: 456px; height: 23px">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="0"
Font-Bold="True" Font-Size="10pt" ForeColor="Black" GridLines="None" Height="5px" Width="456px" >
<FooterStyle BackColor="Tan" />
<Columns>
<asp:BoundField DataField="sno" HeaderText="用户名">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="sname" HeaderText="姓名">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="cno" HeaderText="考核号">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="cname" HeaderText="考核岗位">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="分数">
<EditItemTemplate>
<asp:TextBox ID="TBox1" runat="server" Text='<%# Bind("degree") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="TBox11" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"degree") %>'
Width="25px"></asp:TextBox>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="季度">
<EditItemTemplate>
<asp:TextBox ID="TBox2" runat="server" Text='<%# Bind("jidu") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="TBox22" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"jidu") %>'
Width="25px"></asp:TextBox>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="年度">
<EditItemTemplate>
<asp:TextBox ID="TBox3" runat="server" Text='<%# Bind("year") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="TBox33" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"year") %>'
Width="30px"></asp:TextBox>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:GridView>
<asp:Button
ID="Button2" runat="server" Text="保存成绩" OnClick="Button2_Click" />
<input type="reset" ID="Button3" runat="server" Text="取消" /></td>
</tr>
</table>
</div>
</form>
<p>请在黄色框内输入数字,将自动计算小计及合计。</p>
<SCRIPT language="javascript">
function SumNum10()
{
var sumValue20
a10=eval(_21.value);
b10=eval(_22.value)
if (isNaN(a10))
{a10=0}
if (isNaN(b10))
{b10=0}
sumValue21 = a10/b10;
self['_30'].value =sumValue21;
var sumValue30
a10=eval(_21.value);
b10=eval(_22.value)
if (isNaN(a10))
{a10=0}
if (isNaN(b10))
{b10=0}
sumValue30 = a10/b10*25;
self['_40'].value =sumValue30;add()
}
</script>
<table width="800" border="1" cellspacing="2" cellpadding="10">
<tr>
<th width="30" scope="col">服务满意度</th>
<th width="40" scope="col">业务部门全员问券评分</th>
<th width="20" scope="col">> 8分</th>
<th width="10" scope="col">25</th>
<th width="40" scope="col">满意度表平均分值</th>
<th width="40" bgcolor="#FFFF00" scope="col"><input id="_21" type="text" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum10();"></th>
<th width="40" bgcolor="#FFFF00" scope="col"><input id="_22" type="text" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');SumNum10();"></th>
<th width="40" scope="col"><input id="_30" type="text" size="5"></th>
<th width="40" scope="col"><input id="_40" type="text" size="5"></th>
</tr>
</table>
</script>
<script type="text/javascript">
function add(){
// 如果不是数字,或者没有填写就默认为0
var var000 = parseFloat(document.getElementById('_40').value) || 0;
document.getElementById('_41').value = var000;
}
</script>
<table width="800" border="1" cellspacing="2" cellpadding="10">
<tr>
<th width="30" scope="col">合计</th>
<th width="40" scope="col"><input id="_41" type="text" size="5"></th>
</tr>
</table>
**************************************************
后台代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class inputstudentscore : System.Web.UI.Page
{
CommDB mydb = new CommDB();
DataSet myds = new DataSet();
string mysql;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
mysql = "SELECT cno FROM course WHERE tno='" + Session["uno"] + "'";
myds = mydb.ExecuteQuery(mysql, "course");
if (myds.Tables["course"].Rows.Count > 0)
{
DropDownList1.DataSource = myds.Tables["course"];
DropDownList1.DataTextField = "cno";
DropDownList1.DataBind();
}
else
Response.Redirect("~/dispinfo.aspx?info=没有安排任何考核!");
Button2.Visible = false;
Button3.Visible = false;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string mysql;
mysql = "SELECT * FROM score WHERE tno='" + Session["uno"] + "'AND cno ='" + DropDownList1.SelectedValue + "' ORDER BY sno";
myds = mydb.ExecuteQuery(mysql, "score");
if (myds.Tables["score"].Rows.Count > 0)
{
GridView1.DataSource = myds.Tables["score"];
GridView1.DataBind();
Button2.Visible = true;
Button3.Visible = true;
}
else
Response.Write("<script>alert('没有员工选考或提交该考核!')</script>");
}
protected void Button2_Click(object sender, EventArgs e)
{ //保存成绩
savedata();
Response.Redirect("~/dispinfo.aspx?info=输入的成绩已保存!");
}
protected void savedata() //保存成绩过程
{
string no;
TextBox txtbh;
int i;
for (i = 0; i < GridView1.Rows.Count; i++)
{
no = GridView1.Rows[i].Cells[0].Text; //提取该行的用户名
txtbh = GridView1.Rows[i].FindControl("TBOX11") as TextBox;
//在该行中找TextBox1控件
Update(no, txtbh.Text); //调用自定义过程进行更新
txtbh = GridView1.Rows[i].FindControl("TBox22") as TextBox;
//在该行中找TextBox2控件
Update1(no, txtbh.Text); //调用自定义过程进行更新
txtbh = GridView1.Rows[i].FindControl("TBox33") as TextBox;
//在该行中找TextBox3控件
Update2(no, txtbh.Text); //调用自定义过程进行更新
}
}
protected void Update(string no, string fs)
//自定义过程,用UPDATE语句修改分数
{
mysql = "UPDATE score SET degree=" + fs + " WHERE sno = '" +
no + "' AND cno='" + DropDownList1.SelectedValue + "'";
mydb.ExecuteNonQuery(mysql);
}
protected void Update1(string no, string fs)
//自定义过程,用UPDATE语句修改分数
{
mysql = "UPDATE score SET jidu=" + fs + " WHERE sno = '" +
no + "' AND cno='" + DropDownList1.SelectedValue + "'";
mydb.ExecuteNonQuery(mysql);
}
protected void Update2(string no, string fs)
//自定义过程,用UPDATE语句修改分数
{
mysql = "UPDATE score SET year=" + fs + " WHERE sno = '" +
no + "' AND cno='" + DropDownList1.SelectedValue + "'";
mydb.ExecuteNonQuery(mysql);
}
}