Here I have created sample that will help you out.
HTML
<div>
<cc1:ToolkitScriptManager runat="server">
</cc1:ToolkitScriptManager>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" AllowPaging="true"
PageSize="10" Font-Names="Arial" Font-Size="11pt" AlternatingRowStyle-BackColor="#C2D69B"
HeaderStyle-BackColor="green" OnPageIndexChanging="OnPaging">
<Columns>
<asp:BoundField DataField="ContactName" HeaderText="Contact Name" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:TemplateField>
<HeaderTemplate>
Country:
<asp:DropDownList ID="ddlCountry" runat="server" OnSelectedIndexChanged="CountryChanged"
AutoPostBack="true" AppendDataBoundItems="true">
</asp:DropDownList>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblCountry" Text='<%# Eval("Country") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="PostalCode" HeaderText="Postal Code" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton Text="Review" runat="server" CommandArgument="CustomerId" OnClick="Review" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<cc1:ModalPopupExtender ID="mpe" BehaviorID="mpe" runat="server" PopupControlID="pnlPopup"
TargetControlID="lnkDummy" BackgroundCssClass="modalBackground" CancelControlID="btnHide">
</cc1:ModalPopupExtender>
<asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
<div class="header">
Details
</div>
<div class="body">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
Contact Name :
</td>
<td>
<asp:Label ID="lblContactName" runat="server" />
</td>
</tr>
<tr>
<td>
City :
</td>
<td>
<asp:Label ID="lblCity" runat="server" />
</td>
</tr>
<tr>
<td>
Country :
</td>
<td>
<asp:Label ID="lblCountry" runat="server" />
</td>
</tr>
<tr>
<td>
Postal Code :
</td>
<td>
<asp:Label ID="lblPostalCode" runat="server" />
</td>
</tr>
</table>
<br />
<asp:Button ID="btnHide" runat="server" Text="Hide Modal Popup" />
</div>
</asp:Panel>
</div>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["CountryName"] = "ALL";
BindGrid();
}
}
private void BindGrid()
{
DataTable dt = new DataTable();
String strConnString = System.Configuration.ConfigurationManager
.ConnectionStrings["conString"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
SqlCommand cmd = new SqlCommand("[Customers_GetCustomersCountryWise]");
cmd.CommandType = CommandType.StoredProcedure;
if (ViewState["CountryName"] != null)
{
cmd.Parameters.AddWithValue("@CountryName", ViewState["CountryName"].ToString());
}
cmd.Connection = con;
sda.SelectCommand = cmd;
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
DropDownList ddlCountry =
(DropDownList)GridView1.HeaderRow.FindControl("ddlCountry");
this.BindCountryList(ddlCountry);
}
protected void CountryChanged(object sender, EventArgs e)
{
DropDownList ddlCountry = (DropDownList)sender;
ViewState["CountryName"] = ddlCountry.SelectedValue;
this.BindGrid();
}
private void BindCountryList(DropDownList ddlCountry)
{
String strConnString = System.Configuration.ConfigurationManager
.ConnectionStrings["conString"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
SqlCommand cmd = new SqlCommand("select distinct Country" +
" from customers");
cmd.Connection = con;
con.Open();
ddlCountry.DataSource = cmd.ExecuteReader();
ddlCountry.DataTextField = "Country";
ddlCountry.DataValueField = "Country";
ddlCountry.DataBind();
con.Close();
if (ViewState["CountryName"] != null)
{
ddlCountry.Items.FindByValue(ViewState["CountryName"].ToString())
.Selected = true;
}
}
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
this.BindGrid();
}
protected void Review(object sender, EventArgs e)
{
LinkButton lbtn = (sender as LinkButton);
GridViewRow row = (GridViewRow)(lbtn.NamingContainer);
lblContactName.Text = row.Cells[0].Text;
lblCity.Text = row.Cells[1].Text;
lblCountry.Text = ((Label)row.FindControl("lblCountry")).Text;
lblPostalCode.Text = row.Cells[3].Text;
this.mpe.Show();
}
Screenshot
