My code is: using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data; using AjaxControlToolkit; using System.Text; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadData(); } } private void LoadData() { string constr = "Server=Ahsan-PC;Database=SampleDatabase;INtegrated Security = true;"; string query = "SELECT ProductID, ProductName FROM Products"; SqlDataAdapter da = new SqlDataAdapter(query, constr); DataTable table = new DataTable(); da.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); } protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { PopupControlExtender pce = e.Row.FindControl("PopupControlExtender1") as PopupControlExtender; string behaviorID = "pce_" + e.Row.RowIndex; pce.BehaviorID = behaviorID; Image img = (Image)e.Row.FindControl("Image1"); string OnMouseOverScript = string.Format("$find('{0}').showPopup();", behaviorID); string OnMouseOutScript = string.Format("$find('{0}').hidePopup();", behaviorID); img.Attributes.Add("onmouseover", OnMouseOverScript); img.Attributes.Add("onmouseout", OnMouseOutScript); } } [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()] public static string GetDynamicContent(string contextKey) { string constr = "Server=Ahsan-PC;Database=SampleDatabase;"; string query = "SELECT UnitPrice, UnitsInStock, Description FROM Products WHERE ProductID = '"+contextKey+"'"; SqlDataAdapter da = new SqlDataAdapter(query, constr); DataTable table = new DataTable(); da.Fill(table); StringBuilder b = new StringBuilder(); b.Append("<table style='background-color:#f3f3f3; border: #336699 3px solid; "); b.Append("width:350px; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='3'>"); b.Append("<tr><td colspan='3' style='background-color:#336699; color:white;'>"); b.Append("<b>Product Details</b>"); b.Append("</td></tr>"); b.Append("<tr><td style='width:80px;'><b>Unit Price</b></td>"); b.Append("<td style='width:80px;'><b>Stock</b></td>"); b.Append("<td><b>Description</b></td></tr>"); b.Append("<tr>"); b.Append("<td>$" + table.Rows[0]["UnitPrice"].ToString() + "</td>"); b.Append("<td>" + table.Rows[0]["UnitsInStock"].ToString() + "</td>"); b.Append("<td>" + table.Rows[0]["Description"].ToString() + "</td>"); b.Append("</tr>"); b.Append("</table>"); return b.ToString(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)