protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {

            if (ddlPageSize.SelectedIndex != 0)
            { gvBookings.AllowPaging = true; gvBookings.PageSize = Convert.ToInt32(ddlPageSize.SelectedItem.Text.ToString()); }
            else
            { gvBookings.AllowPaging = false; }

            if (Session["UserID"] != null)
            {
                ClsBAL objManabusBAL = new ClsBAL();
                if (txtfromdate.Text == "") { objManabusBAL.dateOFJourney = null; }
                else { objManabusBAL.dateOFJourney = Convert.ToDateTime(txtfromdate.Text); }
                if (txttodate.Text == "") { objManabusBAL.dateOFBooking = null; }
                else { objManabusBAL.dateOFBooking = Convert.ToDateTime(txttodate.Text); }
                if (ddlSources.SelectedItem.Text != "ALL") { objManabusBAL.sourceName = ddlSources.SelectedItem.Text; }
                if (ddlDestinations.SelectedItem.Text != "ALL") { objManabusBAL.destinationName = ddlDestinations.SelectedItem.Text; }
                if (txtName.Text != "") { objManabusBAL.fullName = txtName.Text.Trim(); }
                if (txtEmailID.Text != "") { objManabusBAL.emailId = txtEmailID.Text; }
                if (txtManabusRefNo.Text != "") { objManabusBAL.manabusRefNo = txtManabusRefNo.Text; }
                // if (ddlOperator.SelectedItem.Text != "-Please Select-") { objManabusBAL.travelName = ddlOperator.SelectedItem.Text; }
                if (txtContact.Text != "") { objManabusBAL.mobileNo = txtContact.Text; }
                if (ddlStatus.SelectedItem.Text != "ALL") { objManabusBAL.status = ddlStatus.SelectedItem.Text; }
                if (txtName.Text != "")
                {
                    ListItem value = ddlOperator.Items.FindByText(txtName.Text.ToString());
                    if (value != null)
                    {
                        ddlOperator.SelectedItem.Value = value.Value;
                        AgentId = Convert.ToInt32(ddlOperator.SelectedValue);
                    }
                    else
                    {
                        AgentId = -1;
                    }

                }
                DataSet ObjDataset = (DataSet)objManabusBAL.SearchAgentBookedTicketsForAdminUser(AgentId);
                if (ObjDataset != null)
                {
                    if (ObjDataset.Tables.Count > 0)
                    {
                        if (ObjDataset.Tables[0].Rows.Count > 0)
                        {
                            //ddlPageSize.Enabled = true;
                            //lbtnXport2Xcel.Enabled = true;
                            //ImageButton3.Visible = true;
                        }
                        else
                        {
                            //lbtnXport2Xcel.Enabled = false;
                        }
                        gvBookings.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
                        gvBookings.DataSource = ObjDataset.Tables[0];
                        gvBookings.DataBind();
                        ViewState["Data"] = ObjDataset.Tables[0];
                    }
                    else
                    {
                        gvBookings.DataSource = ObjDataset;
                        gvBookings.DataBind();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblMsg.InnerHtml = ex.Message;
            throw;
        }
    }