Here's how I created a master/detail gridview where the detail data is shown in a hover panel.
Imports System.Text
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub GridView1_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
'Include three second delay for example only.
System.Threading.Thread.Sleep(3000)
End Sub
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)
Me.HiddenField1.Value = e.CommandArgument.ToString()
End Sub
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
'Primary Key from parent
Dim PrimaryKey As String = ""
'Name of the child update panel
Dim childPanel As String = "UpdatePanel2"
'Offset for x and y positions
'Offset is from upper left corner of PARENT object's current page location
Dim offSetX As Integer = 25
Dim offSetY As Integer = 25
'Skip the header and footer rows
If e.Row.RowType = DataControlRowType.DataRow Then
'Get the Datakey
PrimaryKey = Me.GridView1.DataKeys(e.Row.RowIndex).Values("ListId")
'Find the image and add a mouseover attribute to it.
Dim img As Image = CType(e.Row.FindControl("Image1"), Image)
'Mouseover will fire off the custom "DoPostback" javascript function.
'Check the DoPostBack(stringChildPanelName, stringPrimaryKey) javascript function for complete details
img.Attributes.Add("onmouseover", "DoPostback('" + childPanel + "', '" + PrimaryKey + "', this, 25, 25);")
End If
End Sub
' Here is where the hover panel recieves the Primary Key
Protected Sub UpdatePanel2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles UpdatePanel2.Load
'The __EVENTARGUMENT is the parameter returned by the __doPostBack Javascript function
If Request.Params("__EVENTARGUMENT") IsNot Nothing Then
'I passed in my parameters as a comma separate string; needs to be parsed: primary key, x coordinate, y coordinate
Dim eventArgs() As String = Request.Params("__EVENTARGUMENT").ToString.Split(",")
'Set the hidden field that will be referenced by Child Panel Gridview's datasource
Me.HiddenField1.Value = eventArgs(0).ToString
'Show the div containing the child gridview and set its position using CSS
Me.div_Child.Visible = True
Me.div_Child.Attributes.Add("Style", "overflow:scroll; position:absolute; border:solid 1px navy; background-color:White; width:400px; height:400px; text-align:center; filter: alpha(opacity=95); z-index: 102; left: " + eventArgs(1).ToString + "px; top: " + eventArgs(2).ToString + "px;")
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Me.div_Child.Visible = False
End Sub
End Class