??????+????????У ????????????????????????????????????????? ???粿??????????????????????λ??????????????
2018?????????
?????????????????????????????????????????????????? ????????? 2019??????????-2019??????????????濪?? ??? ?У???
19??????????????????????????????????????У ???????????????н?????????????????仧????? ??????????????????? ????????

????????? ?????????У

?У?绰??
025-84606360
025-52281675
E-mail??
rpjy2008@126.com
??????:b1261199
?У?????www.njccc.cn

?????????????? ??????????????






??? ???????

?γ????

Asp.net girdview??????

???????????ShowFooter="True"??????????SQL????????????????GridView??????????????DataTable(??????)???????RowDataBound?????
???????:
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "???";
e.Row.Cells[3].Text = dtSum.Rows[0][0].ToString();
e.Row.Cells[4].Text = dtSum.Rows[0][1].ToString();
e.Row.Cells[5].Text = dtSum.Rows[0][2].ToString();
e.Row.Cells[6].Text = dtSum.Rows[0][3].ToString();
e.Row.Cells[7].Text = dtSum.Rows[0][4].ToString();
e.Row.Cells[8].Text = dtSum.Rows[0][5].ToString();
e.Row.Cells[9].Text = dtSum.Rows[0][6].ToString();
e.Row.Cells[10].Text = dtSum.Rows[0][7].ToString();
e.Row.Cells[11].Text = dtSum.Rows[0][8].ToString();
}
????dtSum????????DataTable?????GridView????SQL???????????????Ч?????£?

???????????????????е?????(??????????????RowDataBound?????????)
int mysum1 = 0;?
int mysum2 = 0;
protected void GridList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow )
{
DataRowView myrows=(DataRowView)e.Row.DataItem;
mysum1 +=Convert .ToInt32 (myrows[2].ToString ());
mysum2 += Convert.ToInt32(myrows[3].ToString());
}
// ???
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "???";
e.Row.Cells[1].Text = mysum1.ToString();
e.Row.Cells[2].Text = mysum2.ToString();
}
}


??????:

1. ??Web Form ????????,???GridView????,??? OnRowDataBound ??????? OnRowDataBound = "GridView1_RowDataBound"

2. ??????,???ú???????????:
?protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
??? {
??????? GridViewRowEventArgs ea = e as GridViewRowEventArgs;
?????//?ж????????,?????
??????? if (ea.Row.RowType == DataControlRowType.Footer)
??????? {
??????????? DataRowView drv = ea.Row.DataItem as DataRowView;

???? ????// SQL ??????????????????,??к??????????????

??????????? string strQuery = "select 'Total' as column1,'' as column2,sum(col3) as sale_col3,sum(col4)as sum_col4 from order_v" +

??????????????????? " where OrderNo = '" + Request.QueryString["OrderNo"] + "'";

???? ????//?????????????

??????????? SqlConnection cn = new SqlConnection();

??????????? cn.ConnectionString = ConfigurationManager.ConnectionStrings["MainConnectionString"].ConnectionString;

??????????? cn.Open();

??????????? SqlCommand cmdGetItem = new SqlCommand(strQuery, cn);

??????????? SqlDataReader rdr;

??????????? rdr = cmdGetItem.ExecuteReader();

??????????? while (rdr.Read())

??????????? {

??????????????? for (int i = 0; i < rdr.FieldCount; i++)

??????????????? {

???????? ????//?????е??

??????????????????? ea.Row.Cells[i].Text = rdr[i].ToString();

??????????????? }

??????????? }

??????????? rdr.Close();

??????????? cn.Close();

??????? }

??? }

????

???

??л???????????????????!

??????
??????????????????

??????????????????????????

? ? ????? ??????? ?????? ????????? ? ???????
????????? ?????????????????????????????????????绰025-84606360????52281675

???????

???????????

1.??????·47??????????803???????????λ????
??????????:1.???? 2.????(??) 3.?????· 4.???· 5.???? 6.?к???

2.????????·999?????????506 ??????????λ????
??????????:1.??? 2.??? 3.???????? 4.????· 5.??????
?????????????????? 9:00—20:00 ?????????????????У?????www.njccc.cn
??????? ????????????? ?????????У ??????? ?????????????????????ICP??09086834????????? ?? ????????? У????? ?????????