protected void btnSearch_Click(object sender, EventArgs e)
        {
            //Search using entered fields, at least one item needs to be entered
            if ((txtAccountSearch.Text == "") & (txtAddressSearch.Text == "") & (txtConsumerSearch.Text == "") & (txtStandNo.Text == ""))
            {
                //no terms entered, cant search because database is too huge
                lblError.Text    = "Please enter at least one search term";
                lblError.Visible = true;
            }
            else
            {
                //do the search and display in grid for selection
                DataTable          dt = new DataTable();
                Classes.IDBHandler db = new Classes.DBHandler();
                //int headerID = int.Parse(Request.QueryString["JobCardHeaderID"]);

                dt = db.SearchForJobCard(txtAccountSearch.Text, txtConsumerSearch.Text, txtAddressSearch.Text, txtStandNo.Text);

                gvAddingItems.DataSource = dt;
                gvAddingItems.DataBind();
                gvAddingItems.Visible = true;

                if (dt.Rows.Count == 0)
                {
                    lblError.Text    = "There are no records for your search criteria";
                    lblError.Visible = true;
                }
            }
            btnAddItems.Visible = true;

            AddItem.Attributes["style"] = "display: block";
        }
        protected void gvAddingItems_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txtAccountSearch.Text) || !String.IsNullOrWhiteSpace(txtAddressSearch.Text) ||
                !String.IsNullOrWhiteSpace(txtConsumerSearch.Text) || !String.IsNullOrWhiteSpace(txtStandNo.Text))
            {
                DataTable          dt = new DataTable();
                Classes.IDBHandler db = new Classes.DBHandler();

                dt = db.SearchForJobCard(txtAccountSearch.Text, txtConsumerSearch.Text, txtAddressSearch.Text, txtStandNo.Text);

                gvAddingItems.DataSource = dt;
                gvAddingItems.Visible    = true;

                if (dt.Rows.Count == 0)
                {
                    lblError.Text    = "There are no records for your search criteria";
                    lblError.Visible = true;
                }
            }
        }