Ejemplo n.º 1
0
    private void BindGVCustomer()
    {
        string  SelQuery = "SELECT * FROM View_CustomerDetails";
        DataSet DSRecord = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, SelQuery);

        if (DSRecord.Tables[0].Rows.Count > 0)
        {
            GVCustomer.DataSource = DSRecord.Tables[0];
            GVCustomer.DataBind();
        }
        else
        {
            GVCustomer.EmptyDataText = "No Record Found !";
            GVCustomer.DataBind();
        }
        foreach (GridViewRow Row in GVCustomer.Rows)
        {
            Label      lblStatus = (Label)Row.FindControl("lblStatus");
            LinkButton LBEdit    = (LinkButton)Row.FindControl("LBEdit");
            LinkButton LBDelete  = (LinkButton)Row.FindControl("LBDelete");
            if (lblStatus.Text == "Active")
            {
                lblStatus.CssClass = "label label-success";
                LBEdit.Enabled     = true;
                LBDelete.Enabled   = true;
            }
            else
            {
                lblStatus.CssClass = "label label-danger";
                LBEdit.Enabled     = false;
                LBDelete.Enabled   = false;
            }
        }
    }
Ejemplo n.º 2
0
    protected void SearchEvent(object sender, EventArgs e)
    {
        string  SearchQuery = "SELECT * FROM View_CustomerDetails WHERE View_CustomerDetails.CustomerName LIKE '" + TBSearchText.Text.Trim() + "%'";
        DataSet DSRecord    = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, SearchQuery);

        if (DSRecord.Tables[0].Rows.Count > 0)
        {
            GVCustomer.DataSource = DSRecord.Tables[0];
            GVCustomer.DataBind();
        }
        else
        {
            GVCustomer.EmptyDataText = "No Record Found !";
            GVCustomer.DataBind();
        }
        foreach (GridViewRow Row in GVCustomer.Rows)
        {
            Label      lblStatus = (Label)Row.FindControl("lblStatus");
            LinkButton LBEdit    = (LinkButton)Row.FindControl("LBEdit");
            LinkButton LBDelete  = (LinkButton)Row.FindControl("LBDelete");
            if (lblStatus.Text == "Active")
            {
                lblStatus.CssClass = "label label-success";
                LBEdit.Enabled     = true;
                LBDelete.Enabled   = true;
            }
            else
            {
                lblStatus.CssClass = "label label-danger";
                LBEdit.Enabled     = false;
                LBDelete.Enabled   = false;
            }
        }
    }
Ejemplo n.º 3
0
 protected void RebindGrid(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = new DataSet();
         ds = GetPrdLst(GVCustomer.CurrentPageIndex, hdnFilterText.Value);
         GVCustomer.DataSource = ds;
         GVCustomer.DataBind();
     }
     catch (System.Exception ex)
     {
         Login.Profile.ErrorHandling(ex, this, "SearchrateCardAcc.aspx.cs", "RebindGrid");
     }
 }
Ejemplo n.º 4
0
 protected void GVCustomer_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GVCustomer.PageIndex = e.NewPageIndex;
     BindGVCustomer();
     GVCustomer.DataBind();
 }