摘要:ASP.NET Master-Detail GridView(內含子 GridView)
引用ASP.NET 魔法學院 的文章
相關功能請連結至下面頁面:
http://www.dotblogs.com.tw/jeff377/archive/2008/06/21/4348.aspx
相關程式如下:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If (e.Row.RowState And DataControlRowState.Selected) = DataControlRowState.Selected Then
Dim oRow As New GridViewRow(0, -1, DataControlRowType.DataRow, e.Row.RowType)
GridView2.Visible = True
GridView2.DataBind()
Dim sHTML As String = Bee.Web.WebFunc.ControlToHTML(GridView2)
GridView2.Visible = False
Dim oCell As New TableCell
oCell.Text = sHTML
oCell.ColumnSpan = e.Row.Cells.Count
oRow.Cells.Add(oCell)
e.Row.Parent.Controls.AddAt(e.Row.RowIndex + 2, oRow)
End If
End Sub