protected void btnSearch_Click(object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { string search = txtSearch.Text; var product = (from s in db.SP_SearchProduct(search) select s).ToList(); if (product.Count != 0) { Session["ProductId"] = int.Parse((product[1].ProductId).ToString()); Response.Redirect("ProductList.aspx?ProductId=" + Session["ProductId"]); } } }