GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


A Paste by Anonymous
private void BindData()
        {
            DataSet objDst;
            _nPage = int.Parse(ViewState["CurrentPage"].ToString());
            _nPageSize = int.Parse(ViewState["PageSize"].ToString());
            _sSort = ViewState["SortExp"].ToString();

            if (!(ViewState["OfficeID"] == null))
            {
                String sSearch = ViewState["FirstName"] + " " + ViewState["LastName"];
                objDst = SearchAgents(ViewState["OfficeID"].ToString(), sSearch, _nPage, _nPageSize, _sSort, ref _nItemCount);
            } 
            else if (!(ViewState["Alpha"] == null))
            {
                // objDst = GetAgentsByLastName(ViewState["Alpha"].ToString(), false, _nPage, _nPageSize, _sSort, "ASC", ref _nItemCount);
            }
            else
            {
                objDst = GetAgents(false, _nPage, _nPageSize, _sSort, "ASC", ref _nItemCount);
            }
            
            if (!(objDst.Tables[0].Rows.Count == 0))
            {
                dgrdAgentList.DataSource = objDst.Tables[0];
                dgrdAgentList.DataKeyField = "AgentID";
                dgrdAgentList.CurrentPageIndex = _nPage;
                dgrdAgentList.PageSize = _nPageSize;
                dgrdAgentList.VirtualItemCount = _nItemCount;
                dgrdAgentList.DataBind();
                panelIsResults.Visible = true;
                panelNoResults.Visible = false;
            }
            else
            {
                panelIsResults.Visible = false;
                panelNoResults.Visible = true;
            }
            
        }