- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.Footer)
- {
- e.Row.Cells[0].Text = "21";
- e.Row.Cells[1].Text = "All";
- e.Row.Cells[2].Text = "Total Dealers Status";
- //e.Row.Cells[4].Text = Convert.ToInt32(HidCount.Value).ToString("###,###");
- //e.Row.Cells[6].Text = Convert.ToDouble(HidSoldPrice.Value).ToString("C");
- e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Right;
- //e.Row.Cells[4].HorizontalAlign = HorizontalAlign.Right;
- //e.Row.Cells[6].HorizontalAlign = HorizontalAlign.Right;
- //e.Row.Cells[7].Text = DateTime.Now.ToString("yyyy-MM-dd");
- //e.Row.Cells[8].Text = DateTime.Now.ToString(@"HH:mm:ss G/MT zzz");
- }
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Cells[3].Attributes.Add("style", "vnd.ms-excel.numberformat: @");
- //e.Row.Cells[4].Attributes.Add("style", "vnd.ms-excel.numberformat: @");
- }
- if (e.Row.RowType == DataControlRowType.Header)
- {
- GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.Header,
- DataControlRowState.Normal);
- TableCell cell1 = new TableCell();
- cell1.Text = "<b>Report:</b>";
- row.Cells.AddAt(0, cell1);
- TableCell cell2 = new TableCell();
- cell2.Text = "New Loans By Deal";
- row.Cells.AddAt(1, cell2);
- TableCell cell3 = new TableCell();
- cell3.Attributes["align"] = "right";
- cell3.Text = "<font style=/"text-align:right; font-
- weight:bold;/">Date/Time:</font>";
- row.Cells.AddAt(2, cell3);
- //TableCell cell4 = new TableCell();
- //cell4.Text = DateTime.Now.ToString("yyyy-MM-dd") + " " +
- DateTime.Now.ToString(@"HH:mm:ss");
- //row.Cells.AddAt(3, cell4);
- GridView1.Controls[0].Controls.AddAt(0, row);
- }
- }
- }
在RowDataBound中改变或设置Header和Footer
最新推荐文章于 2017-05-07 21:45:37 发布