I have been used the same concept in my project. it looks similar to your requirement, have a look, it might helps.
Design:
<columns>
<asp:boundfield datafield="TraineeId" headertext="TraineeId" xmlns:asp="#unknown" />
<asp:boundfield datafield="Subject" headertext="Subject" xmlns:asp="#unknown" />
<asp:templatefield itemstyle-width="40" itemstyle-horizontalalign="Right" xmlns:asp="#unknown">
<itemtemplate>
<asp:image id="Image1" runat="server" imageurl="~/Images/magnify.gif" />
<ajax:popupcontrolextender id="PopupControlExtender1" runat="server" popupcontrolid="Panel1" xmlns:ajax="#unknown">
TargetControlID="Image1" DynamicContextKey='<%# Eval("NotificationId") %>' DynamicControlID="Panel1"
DynamicServiceMethod="GetDynamicContent" Position="Bottom">
</ajax:popupcontrolextender>
</itemtemplate>
</asp:templatefield>
</columns>
Code behind:
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string GetDynamicContent(string contextKey)
{
SqlConnection SqlCon = new SqlConnection("Data Source=V_rrd2005;Initial Catalog=TrainingDemo;User ID=sa;Password=sa4vij;Asynchronous Processing=true");
SqlCommand SqlCom = new SqlCommand();
DataTable dataTable = null;
dataTable = new DataTable();
SqlCom.Connection = SqlCon;
SqlCom.CommandText = "SELECT * FROM [Notifications] where NotificationId=" + contextKey + " ";
SqlDataAdapter ad = new SqlDataAdapter(SqlCom);
ad.Fill(dataTable);
StringBuilder b = new StringBuilder();
b.Append("<table style="background-color:#f3f3f3; border: #336699 3px solid; ");<br mode="hold" /> b.Append("width:350px; font-size:10pt; font-family:Verdana;" cellspacing="0" cellpadding="3">");
b.Append("<tr><td colspan="4" style="background-color:#336699; color:white;">");
b.Append("Product Details"); b.Append("</td></tr>");
b.Append("<tr><td style="width:80px;">BatchId</td>");
b.Append("<td style="width:80px;">TraineeId</td>");
b.Append("<td style="width:80px;">Description</td>");
b.Append("<td>Priority</td></tr>");
b.Append("<tr>");
b.Append("<td>" + dataTable.Rows[0]["BatchId"].ToString() + "</td>");
b.Append("<td>" + dataTable.Rows[0]["TraineeId"].ToString() + "</td>");
b.Append("<td>" + dataTable.Rows[0]["Description"].ToString() + "</td>");
b.Append("<td>" + dataTable.Rows[0]["Priority"].ToString() + "</td>");
b.Append("</tr>");
b.Append("</table>");
return b.ToString();
}
css:
<style type="text/css">
.fixedHeader
{
height: 25px;
position: absolute;
top: expression(Sys.UI.DomElement.getBounds(document.getElementById("panelContainer")).y-25);
}
</style>