protected void btnSearch_Click(object sender, EventArgs e) { FlightBAL objFlightBal = new FlightBAL(); if (txtRefNo.Text != "") { objFlightBal.RefNo = txtRefNo.Text; } else { objFlightBal.RefNo = null; } if (txtfromdate.Text != "") { DateTime dt = DateTime.Parse(txtfromdate.Text, CultureInfo.GetCultureInfo("en-gb")); objFlightBal.DateOfJourney = Convert.ToDateTime(dt.ToShortDateString()); } else { objFlightBal.DateOfJourney = null; } if (txttodate.Text != "") { DateTime dt = DateTime.Parse(txttodate.Text, CultureInfo.GetCultureInfo("en-gb")); objFlightBal.DateOfIssue= Convert.ToDateTime(dt.ToShortDateString()); } else { objFlightBal.DateOfIssue = null; } if (txtName.Text != "") { objFlightBal.Name =txtName.Text; } else { objFlightBal.Name = null; } if (Session["Role"].ToString() == "Admin") { objFlightBal.TableName = "GetAgentBookings"; } else { objFlightBal.TableName = "Individual Agent Bookings"; objFlightBal.agentId = Convert.ToInt32(Session["UserId"]); } _objDataSet = objFlightBal.CarSearch(objFlightBal); if (_objDataSet != null) { if (_objDataSet.Tables[0].Rows.Count > 0) { gvBookings.DataSource = _objDataSet; Session["GvReports"] = _objDataSet.Tables[0]; gvBookings.DataBind(); } } else { gvBookings.EmptyDataText = "No Records found"; } }