protected void Page_Load(object sender, EventArgs e) { IOccupation OccupationManager; try { if (!IsPostBack) { OccupationManager = (IOccupation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BOccupation, BusinessProcess.Administration"); DataSet theDS = OccupationManager.GetOccupation(); this.grdOccupation.DataSource = theDS.Tables[0]; this.grdOccupation.DataBind(); if (ViewState["grdDataSource"] == null) { ViewState["grdDataSource"] = theDS.Tables[0]; } ViewState["SortDirection"] = "Desc"; BindGrid(); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", this); return; } finally { OccupationManager = null; } }
protected void grdOccupation_PageIndexChanging(object sender, GridViewPageEventArgs e) { IOccupation OccupationManager; try { grdOccupation.PageIndex = e.NewPageIndex; OccupationManager = (IOccupation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BOccupation, BusinessProcess.Administration"); DataSet theDS = OccupationManager.GetOccupation(); this.grdOccupation.DataSource = theDS.Tables[0]; this.grdOccupation.DataBind(); } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", this); return; } finally { OccupationManager = null; } }