Datagrid中数据如下
补考科目 第一学期 第二学期 合计
语文 $80 $80 $160
数学 $85 $85 $170
······
······ 总分 $165 $165 $330点击标题可以排序,其中总分在Footer中,不参与排序。请问如何实现每一列的数值相加,并在Footer中显示,不参与排序。
补考科目 第一学期 第二学期 合计
语文 $80 $80 $160
数学 $85 $85 $170
······
······ 总分 $165 $165 $330点击标题可以排序,其中总分在Footer中,不参与排序。请问如何实现每一列的数值相加,并在Footer中显示,不参与排序。
解决方案 »
- 数据包问题
- 网站发布的问题
- “/”应用程序中的服务器错误。
- 用javascript对用户界面效验的问题。
- 求帮发送邮件怎么写
- 用VisualStudio 2005开发网页四周的空白边缘怎么消除?
- 急!!!excel的问题,请大虾们帮帮忙了!谢谢
- 关于绑定事件遗漏
- 在iis上部署了一个webservice,在iis中能正常运行,但是在一个项目中引用,编译通过,但是运行提示以下错误System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 头 SOAPAction
- 请大佬帮忙:有关Sockets的asp.net编程,在本地机访问正确,但另一台访问本机错误?
- ASP.NET(C#) 如何实现无客户端远程连接ORACLE数据库?
- 请教FileUpload组件的问题
int total1 = 0;
int total2 = 0;
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemIndex>-1)
{
total1+= Convert.ToInt32(e.Item.Cells[1].Text.Substring(1));
total2+= Convert.ToInt32(e.Item.Cells[2].Text.Substring(1));
}
else if(e.Item.ItemType == ListItemType.Footer)
{
e.Item.Cells[0].Text = "总计";
e.Item.Cells[1].Text = total1.ToString();
e.Item.Cells[2].Text total2.ToString();
}
}
<asp:Label id="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "field1")%>'></asp:Label>那么改为
total1+= Convert.ToInt32(((Label)e.Item.FindControl("Label1")).Text.Substring(1));