The solution I am providing here is
working perfectly.
To get the details in the Popup I am performing a search in the dataset.
Can any one give much improved answer to avaoid this searching.
so that performance can be improved.
//========================================================================
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>GridView With ModalPopUpExtender</title>
<style type="text/css">
body
{
font: normal 12px auto "Trebuchet MS", Verdana;
background-color: #ffffff;
color: #4f6b72;
}
.popUpStyle
{
font: normal 11px auto "Trebuchet MS", Verdana;
background-color: #ffffff;
color: #4f6b72;
padding:6px;
filter: alpha(opacity=80);
opacity: 0.8;
}
.drag
{
background-color: #dddddd;
cursor: move;
border:solid 1px gray ;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<cc1:ToolkitScriptManager id="akt1" runat="server"> </cc1:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns ="false" DataKeyNames ="mail_id">
<Columns >
<asp:TemplateField HeaderText="CustomerID">
<ItemTemplate>
<asp:LinkButton runat="server" ID="LinkButton1" Text='<%# Eval("mail_id") %>' OnClick="lnkCustDetails_Click" />
<asp:TextBox ID="hiddenTxt" runat="server" Text='<%# Eval("mail_msg") %>' TextMode ="MultiLine" Visible ="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button runat="server" ID="btnShowModalPopup" style="display:none"/>
<div id ="popupDiv" style ="height :100; width :300; display :none">
<asp:Panel runat="Server" ID="panelDragHandle" CssClass="drag"> Hold here to Drag this Box</asp:Panel>
<asp:TextBox ID="TextBox3" runat="server" TextMode ="MultiLine"></asp:TextBox> <br />
<asp:Button ID="btnClose" runat="server" Text="Close" />
</div>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="btnShowModalPopup"
PopupControlID="popupDiv"
BackgroundCssClass="popUpStyle"
PopupDragHandleControlID="panelDragHandle"
DropShadow="true"
CancelControlID ="btnClose"/>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
//=============================================================================
public partial class _Default : System.Web.UI.Page
{
DataSet ds, DS_ViewState;
SqlDataAdapter da;
protected void Page_Load(object sender, EventArgs e)
{
string constr = System.Web.Configuration.WebConfigurationManager.
ConnectionStrings["sh_hb_dbConnectionString"].ConnectionString;
string sql = "SELECT *FROM tbl_Message";
SqlConnection connection = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand(sql, connection);
cmd.CommandType = CommandType.Text;
ds = new DataSet();
DS_ViewState = new DataSet();
da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.Fill(ds, "tbl_Message");
da.Fill(DS_ViewState, "tbl_Message1");
GridView2.DataSource = ds.Tables ["tbl_Message"];
GridView2.DataBind();
ViewState["keyds"] = ds;
}
protected void lnkCustDetails_Click(object sender, EventArgs e)
{
LinkButton lb = sender as LinkButton;
string usrID = lb.Text.ToString();
DS_ViewState = (DataSet)ViewState["keyds"];
DataRow dr = DS_ViewState.Tables[0].NewRow();
dr = DS_ViewState.Tables[0].Rows.Find(usrID);
TextBox3.Text = dr[4].ToString();
ModalPopupExtender1.Show();
}
}