在<asp:GridView>中有5列<asp:TextBox>控件,第5列“总分”是前面4列的和。有没有方法,能够根据前面4列输入的数值,自动合计得到总分?
我在后台的cs文件中写了方法,在前面4列中输入数值,页面都要刷新,感觉不好,有没有不刷新页面的方法啊,比如javascript的方法。
aspx代码如下:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<table style="width:90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left">
人员绩效考评表
<asp:Button ID="Button1" runat="server" Text="保 存" onclick="btnSave_Click" />
<asp:Label ID="lblMessage" runat="server" ForeColor="Red" Font-Size="12px"></asp:Label>
</td>
</tr>
<tr>
<td align="center">
<asp:GridView ID="gvPerEva" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" BackColor="White" PageSize="250"
BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="2"
GridLines="Horizontal" OnPageIndexChanging="gvPerEva_PageIndexChanging">
<AlternatingRowStyle BackColor="#F7F7F7"/>
<Columns>
<asp:BoundField DataField="工号" HeaderText="工号" ItemStyle-CssClass="hidden" HeaderStyle-
CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="姓名" HeaderText="姓名" HeaderStyle-Width="70px"/>
<asp:BoundField DataField="身份" HeaderText="身份" ItemStyle-CssClass="hidden" HeaderStyle-
CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="部门" HeaderText="部门" HeaderStyle-Width="100px"/>
<asp:BoundField DataField="职务" HeaderText="职务" HeaderStyle-Width="100px"/>
<asp:TemplateField HeaderText="工作业绩(55)" HeaderStyle-Width="100px">
<ItemTemplate><asp:TextBox id="txtPerformance" runat="server" style="width: 60%"/></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="工作态度(21)" HeaderStyle-Width="100px">
<ItemTemplate><asp:TextBox id="txtAttitude" runat="server" style="width: 60%"/></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="工作能力(18)" HeaderStyle-Width="100px">
<ItemTemplate><asp:TextBox id="txtAbility" runat="server" style="width: 60%"/></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="学识水平(6)" HeaderStyle-Width="100px">
<ItemTemplate><asp:TextBox id="txtKnowledge" runat="server" style="width: 60%"/></ItemTemplate>