|
Backstage:
protected void Page_Load (object sender, EventArgs e)
{
System.Collections.Hashtable ht = new Hashtable ();
ht.Add ("AA", true);
ht.Add ("BB", false);
ht.Add ("CC", "2");
ht.Add ("DD", "3");
ht.Add ("EE", "3");
this.GridView1.DataSource = ht;
this.GridView1.DataBind ();
}
protected void GridView1_RowCommand (object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "detail")
{
int iIndex = Convert.ToInt32 (e.CommandArgument);
GridViewRow row = this.GridView1.Rows [iIndex];
GridViewRow NewRow = new GridViewRow (iIndex + 1, iIndex, DataControlRowType.DataRow, DataControlRowState.Normal);
NewRow.Cells.Add (new TableCell ());
NewRow.Cells [0] .ColumnSpan = row.Cells.Count;
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.AddAt (iIndex + 2, NewRow);
NewRow.Cells [0] .Controls.Add (this.rp1);
} |
|