Пример #1
0
        /// <summary>
        /// Fill list of existing client groups
        /// </summary>
        protected void fillgrid()
        {
            Session["TaskTable"] = null;

            if (ViewState["view"] != null)
            {
                objuser.action = "select";
            }
            else
            {
                objuser.action = "selectbyuser";
            }

            objuser.id        = "";
            objuser.createdby = Session["userid"].ToString();
            objuser.name      = hidsearchtitle.Value;
            objuser.empid     = hidsearchempid.Value;
            objuser.companyid = Session["companyid"].ToString();
            ds = objuser.ManageEmployeeGroup();
            int start = dgnews.PageSize * dgnews.PageIndex;
            int end   = start + dgnews.PageSize;

            start = start + 1;
            if (end >= ds.Tables[0].Rows.Count)
            {
                end = ds.Tables[0].Rows.Count;
            }
            lblstart.Text       = start.ToString();
            lblend.Text         = end.ToString();
            lbltotalrecord.Text = ds.Tables[0].Rows.Count.ToString();

            if (ds.Tables[0].Rows.Count > 0)
            {
                Session["TaskTable"] = ds.Tables[0];
                dgnews.DataSource    = ds;
                dgnews.DataBind();
                // btnexportcsv.Enabled = true;

                divnodata.Visible   = false;
                dgnews.Visible      = true;
                lnkprevious.Enabled = true;
                lnknext.Enabled     = true;
                if (lbltotalrecord.Text == lblend.Text)
                {
                    lnknext.Enabled = false;
                }
                if (lblstart.Text == "1")
                {
                    lnkprevious.Enabled = false;
                }
            }
            else
            {
                lblstart.Text       = "0";
                lnkprevious.Enabled = false;
                lnknext.Enabled     = false;
                //  btnexportcsv.Enabled = false;
                if (IsPostBack)
                {
                    divnodata.Visible = true;
                }
                dgnews.Visible = false;

                Session["TaskTable"] = null;
            }
            // updatePanelData.Update();
            dsexcel = ds;
        }