public void BindGVDetail()
    {
        SqlParameter[] arr = new SqlParameter[1];
        arr[0] = new SqlParameter("@Action", "SELECT_ByView");
        DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestMaster_CRUD", arr);

        if (ds.Tables[0].Rows.Count > 0)
        {
            GVItemDetail.DataSource = ds.Tables[0];
            GVItemDetail.DataBind();
        }
        else
        {
            GVItemDetail.EmptyDataText = "No Record Found";
            GVItemDetail.DataBind();
        }
        foreach (GridViewRow gvr in GVItemDetail.Rows)
        {
            foreach (GridViewRow Row in GVItemDetail.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";
                }
                else
                {
                    LblStatus.CssClass = "label label-danger";
                }
            }
        }
    }
Example #2
0
    protected void LBSearch_Click(object sender, EventArgs e)
    {
        SqlParameter[] arrParamDel = new SqlParameter[2];
        arrParamDel[0] = new SqlParameter("@Action", "SEARCH");
        arrParamDel[1] = new SqlParameter("@SearchText", TBSearch.Text);
        DataSet DSRecords = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_ItemRequestMaster_CRUD", arrParamDel);

        if (DSRecords.Tables[0].Rows.Count > 0)
        {
            GVItemDetail.DataSource = DSRecords.Tables[0];
            GVItemDetail.DataBind();
        }
        else
        {
            GVItemDetail.EmptyDataText = "No record Found";
            GVItemDetail.DataBind();
        }
        foreach (GridViewRow gvr in GVItemDetail.Rows)
        {
            foreach (GridViewRow Row in GVItemDetail.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;
                }
            }
        }
    }
Example #3
0
 protected void GVItemDetail_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GVItemDetail.PageIndex = e.NewPageIndex;
     BindGVDetail();
     GVItemDetail.DataBind();
 }