Hi Mohammadmk,
I have created sample that full-fill your requirement.
HTML
<%@ 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></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
table
{
border: 1px solid #ccc;
}
table th
{
background-color: #F7F7F7;
color: #333;
font-weight: bold;
}
table th, table td
{
padding: 5px;
border-color: #ccc;
}
.modalBackground
{
background-color: Black;
filter: alpha(opacity=40);
opacity: 0.4;
}
.modalPopup
{
background-color: #FFFFFF;
border: 3px solid #0DA9D0;
}
.modalPopup .header
{
background-color: #2FBDF1;
height: 30px;
color: White;
line-height: 30px;
text-align: center;
font-weight: bold;
}
.modalPopup .body
{
min-height: 50px;
text-align: center;
padding: 5px;
}
.modalPopup .footer
{
padding: 3px;
}
.modalPopup .button
{
height: 23px;
color: White;
line-height: 23px;
text-align: center;
font-weight: bold;
cursor: pointer;
background-color: #9F9F9F;
border: 1px solid #5C5C5C;
}
.modalPopup td
{
text-align: center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" />
<asp:UpdatePanel runat="server">
<ContentTemplate>
<div align="center">
<table>
<tr>
<td>
First Name
</td>
<td>
<asp:TextBox ID="txtFirstName" runat="server" />
</td>
</tr>
<tr>
<td>
Last Name
</td>
<td>
<asp:TextBox ID="txtLastName" runat="server" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="btnCheck" Text="Check" runat="server" OnClick="Check" />
</td>
</tr>
</table>
</div>
<div>
<asp:LinkButton Text="" ID="lnkFake" runat="server" />
<cc1:ModalPopupExtender ID="mpe" runat="server" PopupControlID="pnlPopup" TargetControlID="lnkFake"
CancelControlID="btnClose" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
<div class="header">
Details
</div>
<div class="body">
<asp:GridView ID="gvEmployee" runat="server" AutoGenerateColumns="false" AllowPaging="true"
PageSize="10">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:BoundField DataField="Address" HeaderText="Address" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:BoundField DataField="Country" HeaderText="Country" />
<asp:BoundField DataField="PostalCode" HeaderText="Postal Code" />
</Columns>
<EmptyDataTemplate>
<table>
<tr>
<th scope="col">
First Name
</th>
<th scope="col">
Last Name
</th>
<th scope="col">
Address
</th>
<th scope="col">
City
</th>
<th scope="col">
Country
</th>
<th scope="col">
Postal Code
</th>
</tr>
<tr align="center">
<td colspan="6">
No Record Found.
</td>
</tr>
</table>
</EmptyDataTemplate>
</asp:GridView>
</div>
<div class="footer" align="center">
<asp:Button ID="btnClose" runat="server" Text="Close" CssClass="button" />
</div>
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
C#
private String strConnString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
protected void Check(object sender, EventArgs e)
{
mpe.Show();
this.BindData(txtFirstName.Text.Trim(), txtLastName.Text.Trim());
}
private void BindData(string firstName, string lastName)
{
string strQuery = "SELECT FirstName,LastName,Address,City,Country,PostalCode FROM Employees WHERE FirstName = '" + firstName + "' AND LastName = '" + lastName + "'";
SqlCommand cmd = new SqlCommand(strQuery);
gvEmployee.DataSource = GetData(cmd);
gvEmployee.DataBind();
}
private DataTable GetData(SqlCommand cmd)
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(strConnString))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
return dt;
}
}
}
VB.Net
Private strConnString As [String] = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Protected Sub Check(sender As Object, e As EventArgs)
mpe.Show()
Me.BindData(txtFirstName.Text.Trim(), txtLastName.Text.Trim())
End Sub
Private Sub BindData(firstName As String, lastName As String)
Dim strQuery As String = (Convert.ToString((Convert.ToString("SELECT FirstName,LastName,Address,City,Country,PostalCode FROM Employees WHERE FirstName = '") & firstName) + "' AND LastName = '") & lastName) + "'"
Dim cmd As New SqlCommand(strQuery)
gvEmployee.DataSource = GetData(cmd)
gvEmployee.DataBind()
End Sub
Private Function GetData(cmd As SqlCommand) As DataTable
Dim dt As New DataTable()
Using con As New SqlConnection(strConnString)
Using sda As New SqlDataAdapter()
cmd.Connection = con
con.Open()
sda.SelectCommand = cmd
sda.Fill(dt)
Return dt
End Using
End Using
End Function
Screenshot
