protected void Button8_Click(object sender, EventArgs e) { presentationlayer pl = new presentationlayer(); pl.pateint_code = TextBox22.Text; clsbusslayer objb = new clsbusslayer(); DataTable dt = new DataTable(); dt = objb.getpateint_byprn(pl); if (dt == null && dt.Rows[0][0] == null) { Response.Write("<script>alert('Record Not Found')</script>"); } else { GridView1.DataSource = dt; GridView1.DataBind(); } }