|
Backstage:
Remove the original rowcommand event.
protected void GridView1_RowDataBound (object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
GridViewRow NewRow = new GridViewRow (0, 0, DataControlRowType.DataRow, DataControlRowState.Normal);
NewRow.Cells.Add (new TableCell ());
NewRow.Cells [0] .ColumnSpan = row.Cells.Count;
//NewRow.Cells[0].Controls.Add(this.rp1);
NewRow.Style.Add ("display", "none");
DataTable dt = new DataTable ();
dt.Columns.Add ("A", typeof (string));
dt.Columns.Add ("B", typeof (string));
dt.Columns.Add ("C", typeof (Int32));
DataRow r1 = dt.NewRow ();
r1 [0] = "Software Engineering";
r1 [1] = "06-01-12";
r1 [2] = 8000;
dt.Rows.Add (r1);
r1 = dt.NewRow ();
r1 [0] = "Website Development";
r1 [1] = "06-11-10";
r1 [2] = 12000;
dt.Rows.Add (r1);
this.rp1.DataSource = dt.DefaultView;
this.rp1.DataBind ();
this.GridView1.Controls [0] .Controls.Add (NewRow);
//this.rp1.RenderControl(Html32TextWriter);
System.Text.StringBuilder sb = new System.Text.StringBuilder ();
Html32TextWriter tr = new Html32TextWriter (new System.IO.StringWriter (sb));
this.rp1.RenderControl (tr);
NewRow.Cells [0] .Text = sb.ToString ();
} |
|