protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { txtStartTime.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); ddlPackback.DataSource = from item in SMSProductService.Query() orderby item.Amount select new { value = item.Id, text = item.Amount }; ddlPackback.DataValueField = "value"; ddlPackback.DataTextField = "text"; ddlPackback.DataBind(); ddlPackback.Items.Insert(0, "所有"); if (!string.IsNullOrEmpty(Request.QueryString["id"])) { ddlPackback.SelectedValue = Request.QueryString["id"]; } InitDataGrid(new Pagination() { PageSize = pager.PageSize, PageIndex = 1, GetRowCount = true }); } this.pager.CurrentPageChanged += pager_CurrentPageChanged; }
void InitDataGrid() { var query = SMSProductService.Query(); grv_Packge.DataSource = from item in query select new { Amount = item.Amount.TrimInvaidZero(), item.Count, EffectiveDate = item.EffectiveDate.ToString("yyyy-MM-dd"), ExpiredDate = item.ExpiredDate.ToString("yyyy-MM-dd"), item.Id, item.SortLevel, item.Enable, item.UnitPrice, item.ExChangeIntegral }; grv_Packge.DataBind(); }