private void InitiData() { DataView[] dv = new CawCostCollectionDB().SelectCostInfo(Session["ORGID"].ToString(), Request.QueryString["Year"], Request.QueryString["Month"], "2"); this.GridView3.DataSource = dv[0]; this.GridView3.DataBind(); this.lblTitle.Text = Session["CompanyName"].ToString() + "港口保安费征缴明细"; }
/// <summary> /// 选择数据 /// </summary> protected void refresh() { int TotalNum = 0; DataView dv = new CawCostCollectionDB().Select(Session["ORGID"].ToString(),"0", this.drgYear.SelectedValue, this.drgMonth.SelectedValue, this.drgStatus.SelectedValue); GridView1.DataSource = dv; GridView1.DataBind(); //调用一个js函数,用于强制执行datagrid的颜色变换。如不用,因updatapanel中数据更新后将无法引起datagridcolor.js的执行 CallJsFun("ChangeColor();"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataView[] dv = new CawCostCollectionDB().Select(); this.GridView1.DataSource = dv[0]; this.GridView1.DataBind(); this.GridView2.DataSource = dv[1]; this.GridView2.DataBind(); this.GridView3.DataSource = dv[2]; this.GridView3.DataBind(); CallJsFun("ChangeCostType();"); } }
private void InitiData() { string Year = ""; string Month = ""; string Message = ""; string[] MonthList = new string[3]; DataView[] dv = new DataView[3]; if (this.radMonth.Checked) { Year = this.drgYear.SelectedValue; if (this.drgMonth.SelectedIndex == 0) { ShowJsMessage("请选择月份"); CallJsFun("ChangeCost();"); return; } Month = this.drgMonth.SelectedValue; this.ViewState["COST2"] = Month; dv = new CawCostCollectionDB().SelectCostInfo(Request.QueryString["CorpGuid"], Server.UrlDecode(Request.QueryString["name"]), Year, Month, "1", out Message); } else if (this.radSeason.Checked) { Year = this.drgYear1.SelectedValue; if (this.drgSeason.SelectedIndex == 0) { ShowJsMessage("请选择季度"); CallJsFun("ChangeCost();"); return; } switch (this.drgSeason.SelectedIndex) { case 1: MonthList[0] = "1"; MonthList[1] = "2"; MonthList[2] = "3"; break; case 2: MonthList[0] = "4"; MonthList[1] = "5"; MonthList[2] = "6"; break; case 3: MonthList[0] = "7"; MonthList[1] = "8"; MonthList[2] = "9"; break; case 4: MonthList[0] = "10"; MonthList[1] = "11"; MonthList[2] = "12"; break; default: break; } this.ViewState["COST2"] = MonthList; dv = new CawCostCollectionDB().SelectCostInfo(Request.QueryString["CorpGuid"], Server.UrlDecode(Request.QueryString["name"]), Year, MonthList, "1", out Message); } if (Message.Trim() != "") { CallJsFun("alert('" + Message + "');window.close();"); return; } this.GridView1.DataSource = dv[2]; this.GridView1.DataBind(); this.GridView2.DataSource = dv[1]; this.GridView2.DataBind(); this.GridView3.DataSource = dv[0]; this.GridView3.DataBind(); if (dv[2].Count < 1) { ShowJsMessage("规费尚未生成"); } CallJsFun("ChangeCost();"); this.ViewState["COST1"] = Year; }