Ejemplo n.º 1
0
    private void Search()
    {
        SqlInt32  CustomerID = SqlInt32.Null;
        SqlString MobileNo   = SqlString.Null;
        SqlInt32  ProductID  = SqlInt32.Null;

        if (ddlCustomerID.SelectedIndex > 0)
        {
            CustomerID = Convert.ToInt32(ddlCustomerID.SelectedValue);
        }

        if (txtMobileSerch.Text.Trim() != "")
        {
            MobileNo = Convert.ToString(txtMobileSerch.Text.Trim());
        }

        if (ddlProductID.SelectedIndex > 0)
        {
            ProductID = Convert.ToInt32(ddlProductID.SelectedValue);
        }

        CustomerBAL balCustomer = new CustomerBAL();
        DataTable   dtCustomer  = balCustomer.CustomerSelectSearch(CustomerID, MobileNo, ProductID);

        if (dtCustomer != null && dtCustomer.Rows.Count > 0)
        {
            gvCustomer.DataSource = dtCustomer;
            gvCustomer.DataBind();
        }
        else
        {
            gvCustomer.DataSource = null;
            gvCustomer.DataBind();
        }
    }