protected void Button2_Click(object sender, EventArgs e) { string slotdate = TextBox1.Text; string slottime = "09:00-09:30"; string username = Convert.ToString(Session["username"]); int result = obj.BookAppointment(username, slottime, slotdate); if (result == 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ss", "<script>alert('Your Appointment Failed')</script>", false); Response.Redirect(ResolveUrl("appointment.aspx")); } else { ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Your appointment has been Scheduled');window.location='appointment.aspx';", true); } }