protected void SearchButton2_Click(object sender, EventArgs e) { da = new SqlDataAdapter("select CancelationId,UserId,BookingId,Refund,convert(varchar,CancelationDate,106)CancelationDate,Description from BookingCancelationDetails where CancelationDate between convert(varchar,'" + TextBox1.Text + "',102) and convert(varchar,'" + TextBox2.Text + "',102)", con); dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { Session["cancelationid"] = dt.Rows[0]["CancelationId"].ToString(); GridViewCancelationDetails.DataSource = dt; GridViewCancelationDetails.DataBind(); } else { GridViewCancelationDetails.DataSource = ""; GridViewCancelationDetails.DataBind(); Label4.Text = "Cancelation Request is not available...."; } }
protected void Page_Load(object sender, EventArgs e) { con = new SqlConnection(ConfigurationManager.AppSettings["con"]); if (Page.IsPostBack == false) { da = new SqlDataAdapter("select * from BookingCancelationDetails where CancelationDate=cast( getdate()as date)", con); dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { GridViewCancelationDetails.DataSource = dt; GridViewCancelationDetails.DataBind(); } else { GridViewCancelationDetails.DataSource = ""; GridViewCancelationDetails.DataBind(); } } }