如题?
解决方案 »
- MySql数据库的乱码问题
- 关于C#调用oracle存储过程的问题
- 也許是ms的bug,歡迎討論
- 在VS2005中使用拖放数据源的方法可以创建Dataset和绑定到界面,如果。。。
- 求助-----在浏览器里点击一个链接 用word打开链接的文档
- *****为何DATALIST不能正常显示数据?****
- 问3个菜鸟问题,100分!
- 请教高手c#中Split 怎么用啊!
- vs2012开发的程序部署到客户端不能预览水晶报表
- VS2013,MVC5 求解答。
- c# 重写IDispatch接口,有答案时继续加分。
- 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“8856f961-340a-11d0-a96b-00c04fd705a2”。
private decimal tjhj =0;
private decimal zlhj =0;
private decimal fhtf = 0;
private decimal dzss = 0;
protected void grv_dzsk_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
jshj += Convert.ToInt16(e.Row.Cells[1].Text);
zlhj += Convert.ToDecimal(e.Row.Cells[2].Text);
tjhj += Convert.ToDecimal(e.Row.Cells[3].Text);
fhtf += Convert.ToDecimal(e.Row.Cells[4].Text);
dzss += Convert.ToDecimal(e.Row.Cells[6].Text);//这一行点击编辑的时候老是提示"输入的字符串格式不正确"
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = jshj.ToString();
e.Row.Cells[2].Text = zlhj.ToString();
e.Row.Cells[3].Text = tjhj.ToString();
e.Row.Cells[4].Text = fhtf.ToString();
e.Row.Cells[5].Text = fhtf.ToString();
e.Row.Cells[6].Text = dzss.ToString();
}
//decimal clyf = Convert.ToDecimal(txt_qrclyf.Text);
//txt_jqyf.Text =Convert.ToString(clyf - fhtf);
//decimal jyyf = Convert.ToDecimal(txt_jyyf.Text); }
{//合计
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView myrows = (DataRowView)e.Row.DataItem;
sum += Convert.ToDouble(myrows[6].ToString());
}
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[5].Text = "合计金额:";
e.Row.Cells[6].Text = sum.ToString();
} }
<FooterTemplate>
合计:<asp:Label ID="Label1" runat="server" Text='<%# Sum %>' />
</FooterTemplate>
protected int Sum; protected int GetSum(int a)
{
Sum += a;
return a;
}
文本框使用onblur计算
function cal1(_obj) {
var tr=_obj.parentNode.parentNode;
var num=tr.cells[4].firstChild;
var pri=tr.cells[5].firstChild;
tr.cells[9].firstChild.value=(num.value==""?0:num.value)+(pri.value==""?0:pri.value);
}
private decimal tjhj =0;
private decimal zlhj =0;
private decimal fhtf = 0;
private decimal dzss = 0;
protected void grv_dzsk_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
jshj += Convert.ToInt16(e.Row.Cells[1].Text);
zlhj += Convert.ToDecimal(e.Row.Cells[2].Text);
tjhj += Convert.ToDecimal(e.Row.Cells[3].Text);
fhtf += Convert.ToDecimal(e.Row.Cells[4].Text);
dzss += Convert.ToDecimal(e.Row.Cells[6].Text);//这一行点击编辑的时候老是提示"输入的字符串格式不正确"
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = jshj.ToString();
e.Row.Cells[2].Text = zlhj.ToString();
e.Row.Cells[3].Text = tjhj.ToString();
e.Row.Cells[4].Text = fhtf.ToString();
e.Row.Cells[5].Text = fhtf.ToString();
e.Row.Cells[6].Text = dzss.ToString();
}
//decimal clyf = Convert.ToDecimal(txt_qrclyf.Text);
//txt_jqyf.Text =Convert.ToString(clyf - fhtf);
//decimal jyyf = Convert.ToDecimal(txt_jyyf.Text);}这是我的cs文件 谁给看看,要怎么改
for (int i = 0; i < dataGridView1.Rows.Count-1; i++)
{
hj+=int.Parse(dataGridView1.Rows[i].Cells["parentid"].Value.ToString());
} label2.Text = "合计值为:"+hj.ToString();
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Management;
namespace TreeView
{
public partial class gethdinfo : Form
{
public gethdinfo()
{
InitializeComponent();
} private void button3_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
using (SqlConnection conn = new SqlConnection("Data source=127.1; initial catalog=tv; user id=sa; password=sa;"))
{
using (SqlDataAdapter da = new SqlDataAdapter("select * from menu", conn))
{
da.Fill(dt);
}
}
dataGridView1.DataSource = dt; label1.Text = "共有数据"+(dataGridView1.Rows.Count-1).ToString();
} private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
int hj = 0;
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
hj += int.Parse(dataGridView1.Rows[i].Cells["parentid"].Value.ToString());
} label2.Text = "合计值为:" + hj.ToString();
}
}
}
我的程序是web 的aspx文件<asp:GridView ID="grv_dzsk" runat="server" AutoGenerateColumns="False"
Width="596px" Height="80px" onrowdatabound="grv_dzsk_RowDataBound"
ShowFooter="True" onrowediting="grv_dzsk_RowEditing"
onrowcancelingedit="grv_dzsk_RowCancelingEdit"
onrowupdating="grv_dzsk_RowUpdating">
<Columns>
<asp:BoundField DataField="sdzbm" HeaderText="经停站" ReadOnly="True" >
<ControlStyle Width="35px" />
<ItemStyle Width="50px" /></asp:BoundField>
<asp:BoundField DataField="fhsl" HeaderText="件数" ReadOnly="True" >
<ControlStyle Width="20px" />
<ItemStyle Width="30px" /></asp:BoundField>
<asp:BoundField DataField="fhzl" HeaderText="重量" ReadOnly="True">
<ControlStyle Width="40px" />
<ItemStyle Width="40px" /></asp:BoundField>
<asp:BoundField DataField="fhtj" HeaderText="体积" ReadOnly="True">
<ControlStyle Width="40px" />
<ItemStyle Width="40px" /></asp:BoundField>
<asp:BoundField DataField="fhtf" HeaderText="上付款" ReadOnly="True">
<ControlStyle Width="40px" />
<ItemStyle Width="40px" /></asp:BoundField>
<asp:BoundField DataField="fhtf" HeaderText="带回运费" ReadOnly="True">
<ControlStyle Width="40px" />
<ItemStyle Width="60px" /></asp:BoundField>
<asp:BoundField DataField="dzss" HeaderText="到站实收" >
<ControlStyle Width="50px" />
<ItemStyle Width="60px" /></asp:BoundField>
<asp:BoundField DataField="sdzbm" HeaderText="卸货站" ReadOnly="True">
<ControlStyle Width="35px" />
<ItemStyle Width="50px" /></asp:BoundField>
<asp:BoundField DataField="yjdzsj" HeaderText="预计到达时间">
<ControlStyle Width="120px" />
</asp:BoundField>
<asp:TemplateField><ItemStyle Width="40px" />
<ItemTemplate><asp:Button ID="Button2" runat="server" Text="编辑" CommandName="Edit"/></ItemTemplate>
<EditItemTemplate>
<asp:Button ID="Button1" runat="server" Text="更新" CommandName="Update" />
<asp:Button ID="Button3" runat="server" Text="取消" CommandName="Cancel"/>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle ForeColor="Maroon" />
</asp:GridView>cs文件
protected void Page_Load(object sender, EventArgs e)
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_fhqdh = sqlhelper.GetDataSet("select fhqdh,clbh,fgsbm,fc_zdzmc,fcsj,clyf,yfyf,yfdj,khyf,fdyf,kkyf,hfyf,zcfy,xcfy,fczt,jsysfz,jsydh from fcqk where fhqdh='"+fhqdh+"'");
if (!IsPostBack) {
txt_fhqdh.Text = fhqdh;
txt_fcsj.Text = ds_fhqdh.Tables[0].Rows[0]["fcsj"].ToString();
txt_qrclbh.Text = ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString();
DataSet ds_clxx = sqlhelper.GetDataSet("select clcd,yfdj from clddxx where clbh='"+ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString()+"'");
txt_qrclcd.Text = ds_clxx.Tables[0].Rows[0]["clcd"].ToString();
txt_qrdj.Text = ds_clxx.Tables[0].Rows[0]["yfdj"].ToString();
txt_qrzdzmc.Text = ds_fhqdh.Tables[0].Rows[0]["fc_zdzmc"].ToString();
txt_qrclyf.Text = ds_fhqdh.Tables[0].Rows[0]["clyf"].ToString();
txt_qryfyf.Text = ds_fhqdh.Tables[0].Rows[0]["yfyf"].ToString(); DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataBind();
}
btn_close.Attributes.Add("onclick", "guanbi();");
}
private int jshj = 0;
private decimal tjhj =0;
private decimal zlhj =0;
private decimal fhtf = 0;
//private decimal dzss = 0;
protected void grv_dzsk_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
jshj += Convert.ToInt16(e.Row.Cells[1].Text);
zlhj += Convert.ToDecimal(e.Row.Cells[2].Text);
tjhj += Convert.ToDecimal(e.Row.Cells[3].Text);
fhtf += Convert.ToDecimal(e.Row.Cells[4].Text);
//dzss += Convert.ToDecimal(e.Row.Cells[6].Text);
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = jshj.ToString();
e.Row.Cells[2].Text = zlhj.ToString();
e.Row.Cells[3].Text = tjhj.ToString();
e.Row.Cells[4].Text = fhtf.ToString();
e.Row.Cells[5].Text = fhtf.ToString();
//e.Row.Cells[6].Text = dzss.ToString();
}
//decimal clyf = Convert.ToDecimal(txt_qrclyf.Text);
//txt_jqyf.Text =Convert.ToString(clyf - fhtf);
//decimal jyyf = Convert.ToDecimal(txt_jyyf.Text); }
protected void grv_dzsk_RowEditing(object sender, GridViewEditEventArgs e)
{
grv_dzsk.EditIndex = e.NewEditIndex;
bind();
}
public void bind()
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataKeyNames = new string[] { "sdzbm" };
grv_dzsk.DataBind();
}
protected void grv_dzsk_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
grv_dzsk.EditIndex = -1;
bind();
}
protected void grv_dzsk_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string fhqdh = Request.Params["fhqdh"].ToString();
string dzss1 = ((TextBox)(grv_dzsk.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim() ;
sqlhelper.RunSQL("update fhxx set dzss='"+dzss1+"' where sdzbm='"+grv_dzsk.DataKeys[e.RowIndex].Value.ToString()+"'");
}
protected void Page_Load(object sender, EventArgs e)
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_fhqdh = sqlhelper.GetDataSet("select fhqdh,clbh,fgsbm,fc_zdzmc,fcsj,clyf,yfyf,yfdj,khyf,fdyf,kkyf,hfyf,zcfy,xcfy,fczt,jsysfz,jsydh from fcqk where fhqdh='"+fhqdh+"'");
if (!IsPostBack) {
txt_fhqdh.Text = fhqdh;
txt_fcsj.Text = ds_fhqdh.Tables[0].Rows[0]["fcsj"].ToString();
txt_qrclbh.Text = ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString();
DataSet ds_clxx = sqlhelper.GetDataSet("select clcd,yfdj from clddxx where clbh='"+ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString()+"'");
txt_qrclcd.Text = ds_clxx.Tables[0].Rows[0]["clcd"].ToString();
txt_qrdj.Text = ds_clxx.Tables[0].Rows[0]["yfdj"].ToString();
txt_qrzdzmc.Text = ds_fhqdh.Tables[0].Rows[0]["fc_zdzmc"].ToString();
txt_qrclyf.Text = ds_fhqdh.Tables[0].Rows[0]["clyf"].ToString();
txt_qryfyf.Text = ds_fhqdh.Tables[0].Rows[0]["yfyf"].ToString(); DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataBind();
}
btn_close.Attributes.Add("onclick", "guanbi();");
}
private int jshj = 0;
private decimal tjhj =0;
private decimal zlhj =0;
private decimal fhtf = 0;
//private decimal dzss = 0;
protected void grv_dzsk_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
jshj += Convert.ToInt16(e.Row.Cells[1].Text);
zlhj += Convert.ToDecimal(e.Row.Cells[2].Text);
tjhj += Convert.ToDecimal(e.Row.Cells[3].Text);
fhtf += Convert.ToDecimal(e.Row.Cells[4].Text);
//dzss += Convert.ToDecimal(e.Row.Cells[6].Text);
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = jshj.ToString();
e.Row.Cells[2].Text = zlhj.ToString();
e.Row.Cells[3].Text = tjhj.ToString();
e.Row.Cells[4].Text = fhtf.ToString();
e.Row.Cells[5].Text = fhtf.ToString();
//e.Row.Cells[6].Text = dzss.ToString();
}
//decimal clyf = Convert.ToDecimal(txt_qrclyf.Text);
//txt_jqyf.Text =Convert.ToString(clyf - fhtf);
//decimal jyyf = Convert.ToDecimal(txt_jyyf.Text); }
protected void grv_dzsk_RowEditing(object sender, GridViewEditEventArgs e)
{
grv_dzsk.EditIndex = e.NewEditIndex;
bind();
}
public void bind()
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataKeyNames = new string[] { "sdzbm" };
grv_dzsk.DataBind();
}
protected void grv_dzsk_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
grv_dzsk.EditIndex = -1;
bind();
}
protected void grv_dzsk_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string fhqdh = Request.Params["fhqdh"].ToString();
string dzss1 = ((TextBox)(grv_dzsk.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim() ;
sqlhelper.RunSQL("update fhxx set dzss='"+dzss1+"' where sdzbm='"+grv_dzsk.DataKeys[e.RowIndex].Value.ToString()+"'");
}protected void Page_Load(object sender, EventArgs e)
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_fhqdh = sqlhelper.GetDataSet("select fhqdh,clbh,fgsbm,fc_zdzmc,fcsj,clyf,yfyf,yfdj,khyf,fdyf,kkyf,hfyf,zcfy,xcfy,fczt,jsysfz,jsydh from fcqk where fhqdh='"+fhqdh+"'");
if (!IsPostBack) {
txt_fhqdh.Text = fhqdh;
txt_fcsj.Text = ds_fhqdh.Tables[0].Rows[0]["fcsj"].ToString();
txt_qrclbh.Text = ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString();
DataSet ds_clxx = sqlhelper.GetDataSet("select clcd,yfdj from clddxx where clbh='"+ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString()+"'");
txt_qrclcd.Text = ds_clxx.Tables[0].Rows[0]["clcd"].ToString();
txt_qrdj.Text = ds_clxx.Tables[0].Rows[0]["yfdj"].ToString();
txt_qrzdzmc.Text = ds_fhqdh.Tables[0].Rows[0]["fc_zdzmc"].ToString();
txt_qrclyf.Text = ds_fhqdh.Tables[0].Rows[0]["clyf"].ToString();
txt_qryfyf.Text = ds_fhqdh.Tables[0].Rows[0]["yfyf"].ToString(); DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataBind();
}
btn_close.Attributes.Add("onclick", "guanbi();");
}
private int jshj = 0;
private decimal tjhj =0;
private decimal zlhj =0;
private decimal fhtf = 0;
//private decimal dzss = 0;
protected void grv_dzsk_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
jshj += Convert.ToInt16(e.Row.Cells[1].Text);
zlhj += Convert.ToDecimal(e.Row.Cells[2].Text);
tjhj += Convert.ToDecimal(e.Row.Cells[3].Text);
fhtf += Convert.ToDecimal(e.Row.Cells[4].Text);
//dzss += Convert.ToDecimal(e.Row.Cells[6].Text);
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = jshj.ToString();
e.Row.Cells[2].Text = zlhj.ToString();
e.Row.Cells[3].Text = tjhj.ToString();
e.Row.Cells[4].Text = fhtf.ToString();
e.Row.Cells[5].Text = fhtf.ToString();
//e.Row.Cells[6].Text = dzss.ToString();
}
//decimal clyf = Convert.ToDecimal(txt_qrclyf.Text);
//txt_jqyf.Text =Convert.ToString(clyf - fhtf);
//decimal jyyf = Convert.ToDecimal(txt_jyyf.Text); }
protected void grv_dzsk_RowEditing(object sender, GridViewEditEventArgs e)
{
grv_dzsk.EditIndex = e.NewEditIndex;
bind();
}
public void bind()
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataKeyNames = new string[] { "sdzbm" };
grv_dzsk.DataBind();
}
protected void grv_dzsk_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
grv_dzsk.EditIndex = -1;
bind();
}
protected void grv_dzsk_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string fhqdh = Request.Params["fhqdh"].ToString();
string dzss1 = ((TextBox)(grv_dzsk.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim() ;
sqlhelper.RunSQL("update fhxx set dzss='"+dzss1+"' where sdzbm='"+grv_dzsk.DataKeys[e.RowIndex].Value.ToString()+"'");
}
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_fhqdh = sqlhelper.GetDataSet("select fhqdh,clbh,fgsbm,fc_zdzmc,fcsj,clyf,yfyf,yfdj,khyf,fdyf,kkyf,hfyf,zcfy,xcfy,fczt,jsysfz,jsydh from fcqk where fhqdh='"+fhqdh+"'");
if (!IsPostBack) {
txt_fhqdh.Text = fhqdh;
txt_fcsj.Text = ds_fhqdh.Tables[0].Rows[0]["fcsj"].ToString();
txt_qrclbh.Text = ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString();
DataSet ds_clxx = sqlhelper.GetDataSet("select clcd,yfdj from clddxx where clbh='"+ds_fhqdh.Tables[0].Rows[0]["clbh"].ToString()+"'");
txt_qrclcd.Text = ds_clxx.Tables[0].Rows[0]["clcd"].ToString();
txt_qrdj.Text = ds_clxx.Tables[0].Rows[0]["yfdj"].ToString();
txt_qrzdzmc.Text = ds_fhqdh.Tables[0].Rows[0]["fc_zdzmc"].ToString();
txt_qrclyf.Text = ds_fhqdh.Tables[0].Rows[0]["clyf"].ToString();
txt_qryfyf.Text = ds_fhqdh.Tables[0].Rows[0]["yfyf"].ToString(); DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataBind();
}
btn_close.Attributes.Add("onclick", "guanbi();");
}
private int jshj = 0;
private decimal tjhj =0;
private decimal zlhj =0;
private decimal fhtf = 0;
//private decimal dzss = 0;
protected void grv_dzsk_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
jshj += Convert.ToInt16(e.Row.Cells[1].Text);
zlhj += Convert.ToDecimal(e.Row.Cells[2].Text);
tjhj += Convert.ToDecimal(e.Row.Cells[3].Text);
fhtf += Convert.ToDecimal(e.Row.Cells[4].Text);
//dzss += Convert.ToDecimal(e.Row.Cells[6].Text);
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = jshj.ToString();
e.Row.Cells[2].Text = zlhj.ToString();
e.Row.Cells[3].Text = tjhj.ToString();
e.Row.Cells[4].Text = fhtf.ToString();
e.Row.Cells[5].Text = fhtf.ToString();
//e.Row.Cells[6].Text = dzss.ToString();
}
//decimal clyf = Convert.ToDecimal(txt_qrclyf.Text);
//txt_jqyf.Text =Convert.ToString(clyf - fhtf);
//decimal jyyf = Convert.ToDecimal(txt_jyyf.Text); }
protected void grv_dzsk_RowEditing(object sender, GridViewEditEventArgs e)
{
grv_dzsk.EditIndex = e.NewEditIndex;
bind();
}
public void bind()
{
string fhqdh = Request.Params["fhqdh"].ToString();
DataSet ds_dzsk = sqlhelper.GetDataSet("SELECT distinct sdzbm,dzss,yjdzsj,SUM(fhsl) as fhsl,SUM(fhzl) as fhzl,SUM(Fhtj) as fhtj,SUM(fhxj) as fhxj,SUM(fhtf) as fhtf,SUM(fhhf) as fhhf,SUM(fhdshk) as dshk from fhxx where fhqdh='" + fhqdh + "' group by Sdzbm,dzss,yjdzsj");
grv_dzsk.DataSource = ds_dzsk.Tables[0].DefaultView;
grv_dzsk.DataKeyNames = new string[] { "sdzbm" };
grv_dzsk.DataBind();
}
protected void grv_dzsk_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
grv_dzsk.EditIndex = -1;
bind();
}
protected void grv_dzsk_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string fhqdh = Request.Params["fhqdh"].ToString();
string dzss1 = ((TextBox)(grv_dzsk.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim() ;
sqlhelper.RunSQL("update fhxx set dzss='"+dzss1+"' where sdzbm='"+grv_dzsk.DataKeys[e.RowIndex].Value.ToString()+"'");
}[/code]