Hi,
Here I have created sample that full-fill your requirement.
Note: If you want to do below using stored procedure use below link to split textbox value in sql and pass it in query(i.e. SELECT * FROM tbl WHERE Name IN (SELECT * FROM dbo.SplitString(@Name))).
HTML
<div>
Search:
<asp:TextBox ID="txtSearch" runat="server" />
<asp:Button Text="Search" runat="server" OnClick="Search" />
<hr />
<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderStyle-Width="150px" DataField="ContactName" HeaderText="Contact Name"
ItemStyle-CssClass="ContactName" HtmlEncode="false" />
<asp:BoundField HeaderStyle-Width="150px" DataField="City" HeaderText="City" />
<asp:BoundField HeaderStyle-Width="150px" DataField="Country" HeaderText="Country" />
</Columns>
</asp:GridView>
</div>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindGrid();
}
}
protected void Search(object sender, EventArgs e)
{
this.BindGrid();
}
private void BindGrid()
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = con;
string resultCont = string.Empty;
if (!string.IsNullOrEmpty(txtSearch.Text))
{
string[] contactNames = txtSearch.Text.Trim().Split(',');
foreach (string cont in contactNames)
{
if (!string.IsNullOrEmpty(cont))
{
resultCont = resultCont + ",'" + cont + "'";
}
}
resultCont = resultCont.Remove(0, 1);
cmd.CommandText = "SELECT ContactName, City, Country FROM Customers WHERE ContactName IN (" + resultCont + ")";
}
else
{
cmd.CommandText = "SELECT ContactName, City, Country FROM Customers";
}
DataTable dt = new DataTable();
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
sda.Fill(dt);
gvCustomers.DataSource = dt;
gvCustomers.DataBind();
}
}
}
}
Screenshot

I hope this will help you out.