首页 新闻 搜索 专区 学院

想把Repeater里的数据导出到Excel中的怎么做?详细讲解一下

0
悬赏园豆:5 [已解决问题] 解决于 2015-10-09 09:54

想把Repeater里的数据导出到Excel中的怎么做?详细讲解一下

博学多思的主页 博学多思 | 初学一级 | 园豆:76
提问于:2015-09-28 15:49
< >
分享
最佳答案
0

protected void Button1_Click(object sender, EventArgs e)        

{            

          ExcelOut(this.Repeater1);        

}        

public void ExcelOut(Repeater gv)        

{

            if (gv.Items.Count > 0)            

            {                

            Response.Clear();                

            Response.ClearContent();                

            Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString     ("yyyyMMdd_HHmmss") + ".xls");                

            Response.ContentEncoding = System.Text.Encoding.UTF8;                

            Response.ContentType = "application/ms-excel";                

            StringWriter sw = new StringWriter();                

            HtmlTextWriter htw = new HtmlTextWriter(sw);                

            gv.RenderControl(htw);                

            Response.Write(sw.ToString());                

            Response.Flush();                

            Response.End();            

            }            

            else            

           {                

                  Response.Write("没有数据");            

           }        

}        

public override void VerifyRenderingInServerForm(System.Web.UI.Control control)        

{            

         //base.VerifyRenderingInServerForm(control);        

}        

protected void Repeater1_ItemCommand1(object source, RepeaterCommandEventArgs e)        

{

 }

收获园豆:5
潘雪婷 | 菜鸟二级 |园豆:204 | 2015-09-29 09:46

导出的Excel是这样的,怎么整/

博学多思 | 园豆:76 (初学一级) | 2015-09-29 09:48

@博学多思: 你想导出什么样的?给我看看你原来的repeater里数据什么样的

潘雪婷 | 园豆:204 (菜鸟二级) | 2015-09-29 09:51

@潘雪婷: 

博学多思 | 园豆:76 (初学一级) | 2015-09-29 09:52

@潘雪婷: 

博学多思 | 园豆:76 (初学一级) | 2015-09-29 09:52

@博学多思: repeater你怎么绑定数据的?我看不太清楚你的图片,只能看出来蛮复杂的报表,你把代码给我看看吧,还有你怎么乱码?你用简体还是繁体?

潘雪婷 | 园豆:204 (菜鸟二级) | 2015-09-29 09:58

@潘雪婷: 

public partial class NewWaterManage_Statistics_FMDS_Water_IrrigaDrainageStat : YYSSOFT.Lib2008.Web.UI.BasePage
{
    //灌溉
    decimal Gg = 0;
    //控制面积
    decimal Km = 0;
    //水泵数
    decimal Ss = 0;
    //机电数
    decimal Js = 0;
    //厂房建筑面积
    decimal Cm = 0;
    //年运行时间
    decimal Nj = 0;
    //年平均耗电量
    decimal Nh = 0;
    //排涝面积小计设计
    decimal Plxs = 0;
    //排涝面积小计现状
    decimal Plxx = 0;
    //排涝面积旱田设计
    decimal Plhs = 0;
    // 排涝面积旱田现状
    decimal Plhx = 0;
    //排涝面积水田设计
    decimal Plss = 0;
    //排涝面积水田现状
    decimal Plsx = 0;
    //灌溉面积小计设计
    decimal Ggxs = 0;
    //灌溉面积小计现状
    decimal Ggxx = 0;
    //灌溉面积旱田设计
    decimal Gghs = 0;
    // 灌溉面积旱田现状 
    decimal Gghx = 0;
    //灌溉面积水田设计
    decimal Ggss = 0;
    //灌溉面积水田现状
    decimal Ggsx = 0;
    decimal Tc = 0;
    decimal Tl = 0;
    decimal Sc = 0;
    decimal Sl = 0;
    decimal Gc = 0;
    decimal Gl = 0;
    decimal Hc = 0;
    decimal Hl = 0;
    decimal Gtc = 0;
    decimal Gtl = 0;
    decimal Zc = 0;
    decimal Zl = 0;
    int Ggs = 0;
    List<FMDS_Water_IrrigaDrainageStatInfo> List = new List<FMDS_Water_IrrigaDrainageStatInfo>();
    //页面加载
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            IniData();
        }
        else
        {
            lblError.Text = string.Empty;
        }
    }
    /// <summary>
    /// 当前选中组织机构ID
    /// </summary>
    public string OrgUnitID { get; set; }
    /// <summary>
    /// 当前选中组织机构级别
    /// </summary>
    public string OrgLevel { get; set; }
    /// <summary>
    /// 分局ID
    /// </summary>
    public string SubOrgID { get; set; }
    /// <summary>
    /// 农场ID
    /// </summary>
    public string OrganiseUnitID { get; set; }
    /// <summary>
    /// 管理区ID/直属作业站ID
    /// </summary>
    public string SubFarmID { get; set; }
    /// <summary>
    /// 作业站ID
    /// </summary>
    public string WorkStationID { get; set; }
  //绑定组织机构 
    void OrganiseUnitBind(DropDownList ddl, int ID, int Level)
    {
        ddl.Items.Clear();
        ddl.DataTextField = "OrganiseUnitName";
        ddl.DataValueField = "OrganiseUnitID";
        ddl.DataSource = new SDMS_OrganiseUnitBLLEX().GetSubOrgModelList(ID, Level, ID == 25 ? "1" : "");
        ddl.DataBind();
        ddl.Items.Insert(0, new ListItem("请选择", ""));
    }
    /// <summary>
    /// 初始化页面控件
    /// </summary>
    public void IniData()
    {
        OrgUnitID = CurrentUserInfo.OrgLevel > 3 ? CurrentUserInfo.FOrgID.ToString() : CurrentUserInfo.OrgID.ToString();
        OrgLevel = CurrentUserInfo.OrgLevel == 4 && CurrentUserInfo.OrgLevelEx == 5 ? "45" : CurrentUserInfo.OrgLevel.ToString();
        switch (CurrentUserInfo.OrgLevel)
        {
            case 1:
                OrganiseUnitBind(ddlSubOrgID, 26, 2);
                break;
            case 2:
                OrganiseUnitBind(ddlSubOrgID, 26, 2);
                ddlSubOrgID.SelectedValue = CurrentUserInfo.OrgID.ToString();
                ddlSubOrgID.Enabled = false;
                OrganiseUnitBind(ddlOrganiseUnitID, CurrentUserInfo.OrgID, 3);
                break;
            case 3:
                OrganiseUnitBind(ddlSubOrgID, 26, 2);
                ddlSubOrgID.SelectedValue = CurrentUserInfo.IsStok ? "25" : CurrentUserInfo.OrgParentID.ToString();
                ddlSubOrgID.Enabled = false;
                OrganiseUnitBind(ddlOrganiseUnitID, Convert.ToInt32(ddlSubOrgID.SelectedValue), 3);
                ddlOrganiseUnitID.SelectedValue = CurrentUserInfo.OrgID.ToString();
                ddlOrganiseUnitID.Enabled = false;

                break;
        }
        FMDS_Water_IrrigaDrainageStatBLL bll = new FMDS_Water_IrrigaDrainageStatBLL();
        QueryBuilder queryBuilder = new QueryBuilder();
        queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ISDELETE_FIELD, "=", 0);
        if (!string.IsNullOrEmpty(ddlSubOrgID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "in", "(select OrganiseUnitID from SDMS_OrganiseUnit where OrganiseUnitCode like '%'+(select OrganiseUnitCode from SDMS_OrganiseUnit where OrganiseUnitID=" + CurrentUserInfo.OrgID + ")+'%' and OrganiseUnitModel=1 and IsDelete=0)", FilterType.Unknown);

        }
        if (!string.IsNullOrEmpty(ddlOrganiseUnitID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "=", ddlOrganiseUnitID.SelectedValue);
        }
        queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ISDELETE_FIELD, "=", 0);
        queryBuilder.AddOrderASC(SDMS_OrganiseUnitInfo.SDMS_ORGANISEUNIT_TABLE, SDMS_OrganiseUnitInfo.DISPLAYINDEX_FIELD);

        queryBuilder.AddOrderDESC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD);
        queryBuilder.AddOrderASC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.PUMPINGNAME_FIELD);
        List = bll.GetModelListBySql1(queryBuilder);
        FMDS_Water_IrrigaDrainageStatInfo m = new FMDS_Water_IrrigaDrainageStatInfo { OrganiseUnitName = "统计" };
        List.Insert(0, m);
        this.rptrList.DataSource = List;
        this.rptrList.DataBind();

    }
    //绑定事件
    protected void rptrList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            FMDS_Water_IrrigaDrainageStatInfo drv = (FMDS_Water_IrrigaDrainageStatInfo)e.Item.DataItem;



            if (string.IsNullOrEmpty(drv.PumpModel) && string.IsNullOrEmpty(drv.PumpManu) && drv.PumpUnits == int.MinValue && drv.PumpTime.ToString() == "1900/1/1 0:00:00" && drv.PumpPower == int.MinValue)
            {
                Label lblPumpUnits = (Label)e.Item.FindControl("lblPumpUnits");

                lblPumpUnits.Text = "0";
                Ss += 0;

            }
            else
            {
                Label lblPumpUnits = (Label)e.Item.FindControl("lblPumpUnits");

                lblPumpUnits.Text = "1";
                Ss += 1;
            }


            if (string.IsNullOrEmpty(drv.EquipType) && string.IsNullOrEmpty(drv.MachManuf) && drv.MachUnits == int.MinValue && drv.MachTime.ToString() == "1900/1/1 0:00:00" && drv.PowerEquip == int.MinValue)
            {
                Label lblMachUnits = (Label)e.Item.FindControl("lblMachUnits");

                lblMachUnits.Text = "0";
                Js += 0;

            }
            else
            {
                Label lblMachUnits = (Label)e.Item.FindControl("lblMachUnits");

                lblMachUnits.Text = "1";
                Js += 1;

            }
            Gg += drv.IrrigaDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.IrrigaDesign);
            Km += drv.ConArea == int.MinValue ? 0 : Convert.ToDecimal(drv.ConArea);

            if (drv.IrrigaDesign != 0 && drv.IrrigaDesign != int.MinValue)
            {
                Ggs++;
            }
            Cm += drv.ConstruArea == int.MinValue ? 0 : Convert.ToDecimal(drv.ConstruArea);

            Nj += drv.AnnopeTime == int.MinValue ? 0 : Convert.ToDecimal(drv.AnnopeTime);
            Nh += drv.AveragePower == int.MinValue ? 0 : Convert.ToDecimal(drv.AveragePower);
            Ggxs += drv.TotalIrriDes == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalIrriDes);
            Ggxx += drv.TotalIrriSta == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalIrriSta);
            Ggss += drv.PaddyDes == int.MinValue ? 0 : Convert.ToDecimal(drv.PaddyDes);
            Ggsx += drv.IrigaSta == int.MinValue ? 0 : Convert.ToDecimal(drv.IrigaSta);
            Gghs += drv.IrriDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.IrriDesign);
            Gghx += drv.IrriStat == int.MinValue ? 0 : Convert.ToDecimal(drv.IrriStat);
            Plxs += drv.TotalDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalDesign);
            Plxx += drv.TotalSitua == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalSitua);
            Plhs += drv.DryDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.DryDesign);
            Plhx += drv.GlebeStatus == int.MinValue ? 0 : Convert.ToDecimal(drv.GlebeStatus);
            Plss += drv.PaddyDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.PaddyDesign);
            Plsx += drv.DrainSitua == int.MinValue ? 0 : Convert.ToDecimal(drv.DrainSitua);
            Tc += drv.InitialWork == int.MinValue ? 0 : Convert.ToDecimal(drv.InitialWork);
            Tl += drv.EarthCumula == int.MinValue ? 0 : Convert.ToDecimal(drv.EarthCumula);
            Sc += drv.StoneInit == int.MinValue ? 0 : Convert.ToDecimal(drv.StoneInit);
            Sl += drv.StoneWork == int.MinValue ? 0 : Convert.ToDecimal(drv.StoneWork);
            Gc += drv.IniConSqu == int.MinValue ? 0 : Convert.ToDecimal(drv.IniConSqu);
            Gl += drv.ConcrCumula == int.MinValue ? 0 : Convert.ToDecimal(drv.ConcrCumula);
            Hc += drv.RaisedTotal == int.MinValue ? 0 : Convert.ToDecimal(drv.RaisedTotal);
            Hl += drv.SccumulaTotal == int.MinValue ? 0 : Convert.ToDecimal(drv.SccumulaTotal);
            Gtc += drv.Sinitial == int.MinValue ? 0 : Convert.ToDecimal(drv.Sinitial);
            Gtl += drv.Sccumula == int.MinValue ? 0 : Convert.ToDecimal(drv.Sccumula);
            Zc += drv.Initialself == int.MinValue ? 0 : Convert.ToDecimal(drv.Initialself);
            Zl += drv.Raised == int.MinValue ? 0 : Convert.ToDecimal(drv.Raised);

        }

    }
    
    protected override void Render(HtmlTextWriter writer)
    {

        if (List.Count != 1 && List.Count != 0)
        {
            Label lblIrrigaDesign = (Label)rptrList.Items[0].FindControl("lblIrrigaDesign");
            if (Ggs != 0)
            {

                lblIrrigaDesign.Text = (Gg / Ggs).ToString();
            }

            Label lblConArea = (Label)rptrList.Items[0].FindControl("lblConArea");

            lblConArea.Text = Km.ToString();


            Label lblConstruArea = (Label)rptrList.Items[0].FindControl("lblConstruArea");

            lblConstruArea.Text = Cm.ToString();


            Label lblAnnopeTime = (Label)rptrList.Items[0].FindControl("lblAnnopeTime");

            lblAnnopeTime.Text = Nj.ToString();

            Label lblPumpUnits = (Label)rptrList.Items[0].FindControl("lblPumpUnits");

            lblPumpUnits.Text = (Ss).ToString();


            Label lblMachUnits = (Label)rptrList.Items[0].FindControl("lblMachUnits");

            lblMachUnits.Text = (Js).ToString();
            Label lblAveragePower = (Label)rptrList.Items[0].FindControl("lblAveragePower");

            lblAveragePower.Text = (Nh).ToString();
            Label lblTotalDesign = (Label)rptrList.Items[0].FindControl("lblTotalDesign");

            lblTotalDesign.Text = Plxs.ToString();
            Label lblTotalSitua = (Label)rptrList.Items[0].FindControl("lblTotalSitua");
            lblTotalSitua.Text = Plxx.ToString();
            Label lblDryDesign = (Label)rptrList.Items[0].FindControl("lblDryDesign");

            lblDryDesign.Text = Plhs.ToString();
            Label lblGlebeStatus = (Label)rptrList.Items[0].FindControl("lblGlebeStatus");

            lblGlebeStatus.Text = Plhx.ToString();
            Label lblPaddyDesign = (Label)rptrList.Items[0].FindControl("lblPaddyDesign");
            lblPaddyDesign.Text = Plss.ToString();
            Label lblDrainSitua = (Label)rptrList.Items[0].FindControl("lblDrainSitua");
            lblDrainSitua.Text = Plsx.ToString();
            Label lblTotalIrriDes = (Label)rptrList.Items[0].FindControl("lblTotalIrriDes");

            lblTotalIrriDes.Text = Ggxs.ToString();
            Label lblTotalIrriSta = (Label)rptrList.Items[0].FindControl("lblTotalIrriSta");
            lblTotalIrriSta.Text = Ggxx.ToString();
            Label lblIrriDesign = (Label)rptrList.Items[0].FindControl("lblIrriDesign");

            lblIrriDesign.Text = Gghs.ToString("0.00");


            Label lblIrriStat = (Label)rptrList.Items[0].FindControl("lblIrriStat");

            lblIrriStat.Text = Gghx.ToString();


            Label lblPaddyDes = (Label)rptrList.Items[0].FindControl("lblPaddyDes");

            lblPaddyDes.Text = Ggss.ToString();




            Label lblIrigaSta = (Label)rptrList.Items[0].FindControl("lblIrigaSta");

            lblIrigaSta.Text = Ggsx.ToString();


            Label lblEarthCumula = (Label)rptrList.Items[0].FindControl("lblEarthCumula");

            lblEarthCumula.Text = Tl.ToString();
            Label lblInitialWork = (Label)rptrList.Items[0].FindControl("lblInitialWork");
            lblInitialWork.Text = Tc.ToString();
            Label lblStoneWork = (Label)rptrList.Items[0].FindControl("lblStoneWork");
            lblStoneWork.Text = Sl.ToString();
            Label lblStoneInit = (Label)rptrList.Items[0].FindControl("lblStoneInit");
            lblStoneInit.Text = Sc.ToString();
            Label lblConcrCumula = (Label)rptrList.Items[0].FindControl("lblConcrCumula");
            lblConcrCumula.Text = Gl.ToString();
            Label lblIniConSqu = (Label)rptrList.Items[0].FindControl("lblIniConSqu");
            lblIniConSqu.Text = Gc.ToString();
            Label lblSccumulaTotal = (Label)rptrList.Items[0].FindControl("lblSccumulaTotal");
            lblSccumulaTotal.Text = Hl.ToString();
            Label lblRaisedTotal = (Label)rptrList.Items[0].FindControl("lblRaisedTotal");
            lblRaisedTotal.Text = Hc.ToString();
            Label lblSccumula = (Label)rptrList.Items[0].FindControl("lblSccumula");
            lblSccumula.Text = Gtl.ToString();
            Label lblSinitial = (Label)rptrList.Items[0].FindControl("lblSinitial");

            lblSinitial.Text = Gtc.ToString();
            Label lblRaised = (Label)rptrList.Items[0].FindControl("lblRaised");

            lblRaised.Text = Zl.ToString();


            Label lblInitialself = (Label)rptrList.Items[0].FindControl("lblInitialself");

            lblInitialself.Text = Zc.ToString();
        }

        Label lblYear1 = (Label)rptrList.Items[0].FindControl("lblYear");

        lblYear1.Text = " ";

        base.Render(writer);

    }
    //绑定事件
    public void BindGrid()
    {
        plResult.Visible = true;
        QueryBuilder queryBuilder = new QueryBuilder();

        if (!string.IsNullOrEmpty(ddlSubOrgID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "in", "(select OrganiseUnitID from SDMS_OrganiseUnit where OrganiseUnitCode like '%'+(select OrganiseUnitCode from SDMS_OrganiseUnit where OrganiseUnitID=" + CurrentUserInfo.OrgID + ")+'%' and OrganiseUnitModel=1 and IsDelete=0)", FilterType.Unknown);
        }
        if (!string.IsNullOrEmpty(ddlOrganiseUnitID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "=", ddlOrganiseUnitID.SelectedValue);
        }
        if (!string.IsNullOrEmpty(txtPumpingName.Text.Trim()))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.PUMPINGNAME_FIELD, "LIKE", txtPumpingName.Text.Trim());
        }
        if (!string.IsNullOrEmpty(txtStartDate.Text.Trim()))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD, ">=", txtStartDate.Text.Trim());
        }
        if (!string.IsNullOrEmpty(txtEndDate.Text.Trim()))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD, "<=", txtEndDate.Text.Trim());
        }

        queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ISDELETE_FIELD, "=", 0);

        queryBuilder.AddOrderASC(SDMS_OrganiseUnitInfo.SDMS_ORGANISEUNIT_TABLE, SDMS_OrganiseUnitInfo.DISPLAYINDEX_FIELD);

        queryBuilder.AddOrderDESC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD);
        queryBuilder.AddOrderASC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.PUMPINGNAME_FIELD);
        FMDS_Water_IrrigaDrainageStatBLL bll = new FMDS_Water_IrrigaDrainageStatBLL();


        List = bll.GetModelListBySql1(queryBuilder);
        FMDS_Water_IrrigaDrainageStatInfo m = new FMDS_Water_IrrigaDrainageStatInfo { OrganiseUnitName = "统计" };
        List.Insert(0, m);
        this.rptrList.DataSource = List;
        this.rptrList.DataBind();

    }
    //查询按钮
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {

            BindGrid();
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
}
博学多思 | 园豆:76 (初学一级) | 2015-09-29 10:03

@博学多思: 你放的这些代码是什么意思?有导出的代码吗?不好意思,我没找到

潘雪婷 | 园豆:204 (菜鸟二级) | 2015-09-29 10:11

@潘雪婷: 

public partial class NewWaterManage_Statistics_FMDS_Water_IrrigaDrainageStat : YYSSOFT.Lib2008.Web.UI.BasePage
{
    //灌溉
    decimal Gg = 0;
    //控制面积
    decimal Km = 0;
    //水泵数
    decimal Ss = 0;
    //机电数
    decimal Js = 0;
    //厂房建筑面积
    decimal Cm = 0;
    //年运行时间
    decimal Nj = 0;
    //年平均耗电量
    decimal Nh = 0;
    //排涝面积小计设计
    decimal Plxs = 0;
    //排涝面积小计现状
    decimal Plxx = 0;
    //排涝面积旱田设计
    decimal Plhs = 0;
    // 排涝面积旱田现状
    decimal Plhx = 0;
    //排涝面积水田设计
    decimal Plss = 0;
    //排涝面积水田现状
    decimal Plsx = 0;
    //灌溉面积小计设计
    decimal Ggxs = 0;
    //灌溉面积小计现状
    decimal Ggxx = 0;
    //灌溉面积旱田设计
    decimal Gghs = 0;
    // 灌溉面积旱田现状 
    decimal Gghx = 0;
    //灌溉面积水田设计
    decimal Ggss = 0;
    //灌溉面积水田现状
    decimal Ggsx = 0;
    decimal Tc = 0;
    decimal Tl = 0;
    decimal Sc = 0;
    decimal Sl = 0;
    decimal Gc = 0;
    decimal Gl = 0;
    decimal Hc = 0;
    decimal Hl = 0;
    decimal Gtc = 0;
    decimal Gtl = 0;
    decimal Zc = 0;
    decimal Zl = 0;
    int Ggs = 0;
    List<FMDS_Water_IrrigaDrainageStatInfo> List = new List<FMDS_Water_IrrigaDrainageStatInfo>();
    //页面加载
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            IniData();
        }
        else
        {
            lblError.Text = string.Empty;
        }
    }
    /// <summary>
    /// 当前选中组织机构ID
    /// </summary>
    public string OrgUnitID { get; set; }
    /// <summary>
    /// 当前选中组织机构级别
    /// </summary>
    public string OrgLevel { get; set; }
    /// <summary>
    /// 分局ID
    /// </summary>
    public string SubOrgID { get; set; }
    /// <summary>
    /// 农场ID
    /// </summary>
    public string OrganiseUnitID { get; set; }
    /// <summary>
    /// 管理区ID/直属作业站ID
    /// </summary>
    public string SubFarmID { get; set; }
    /// <summary>
    /// 作业站ID
    /// </summary>
    public string WorkStationID { get; set; }
  //绑定组织机构 
    void OrganiseUnitBind(DropDownList ddl, int ID, int Level)
    {
        ddl.Items.Clear();
        ddl.DataTextField = "OrganiseUnitName";
        ddl.DataValueField = "OrganiseUnitID";
        ddl.DataSource = new SDMS_OrganiseUnitBLLEX().GetSubOrgModelList(ID, Level, ID == 25 ? "1" : "");
        ddl.DataBind();
        ddl.Items.Insert(0, new ListItem("请选择", ""));
    }
    /// <summary>
    /// 初始化页面控件
    /// </summary>
    public void IniData()
    {
        OrgUnitID = CurrentUserInfo.OrgLevel > 3 ? CurrentUserInfo.FOrgID.ToString() : CurrentUserInfo.OrgID.ToString();
        OrgLevel = CurrentUserInfo.OrgLevel == 4 && CurrentUserInfo.OrgLevelEx == 5 ? "45" : CurrentUserInfo.OrgLevel.ToString();
        switch (CurrentUserInfo.OrgLevel)
        {
            case 1:
                OrganiseUnitBind(ddlSubOrgID, 26, 2);
                break;
            case 2:
                OrganiseUnitBind(ddlSubOrgID, 26, 2);
                ddlSubOrgID.SelectedValue = CurrentUserInfo.OrgID.ToString();
                ddlSubOrgID.Enabled = false;
                OrganiseUnitBind(ddlOrganiseUnitID, CurrentUserInfo.OrgID, 3);
                break;
            case 3:
                OrganiseUnitBind(ddlSubOrgID, 26, 2);
                ddlSubOrgID.SelectedValue = CurrentUserInfo.IsStok ? "25" : CurrentUserInfo.OrgParentID.ToString();
                ddlSubOrgID.Enabled = false;
                OrganiseUnitBind(ddlOrganiseUnitID, Convert.ToInt32(ddlSubOrgID.SelectedValue), 3);
                ddlOrganiseUnitID.SelectedValue = CurrentUserInfo.OrgID.ToString();
                ddlOrganiseUnitID.Enabled = false;

                break;
        }
        FMDS_Water_IrrigaDrainageStatBLL bll = new FMDS_Water_IrrigaDrainageStatBLL();
        QueryBuilder queryBuilder = new QueryBuilder();
        queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ISDELETE_FIELD, "=", 0);
        if (!string.IsNullOrEmpty(ddlSubOrgID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "in", "(select OrganiseUnitID from SDMS_OrganiseUnit where OrganiseUnitCode like '%'+(select OrganiseUnitCode from SDMS_OrganiseUnit where OrganiseUnitID=" + CurrentUserInfo.OrgID + ")+'%' and OrganiseUnitModel=1 and IsDelete=0)", FilterType.Unknown);

        }
        if (!string.IsNullOrEmpty(ddlOrganiseUnitID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "=", ddlOrganiseUnitID.SelectedValue);
        }
        queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ISDELETE_FIELD, "=", 0);
        queryBuilder.AddOrderASC(SDMS_OrganiseUnitInfo.SDMS_ORGANISEUNIT_TABLE, SDMS_OrganiseUnitInfo.DISPLAYINDEX_FIELD);

        queryBuilder.AddOrderDESC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD);
        queryBuilder.AddOrderASC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.PUMPINGNAME_FIELD);
        List = bll.GetModelListBySql1(queryBuilder);
        FMDS_Water_IrrigaDrainageStatInfo m = new FMDS_Water_IrrigaDrainageStatInfo { OrganiseUnitName = "统计" };
        List.Insert(0, m);
        this.rptrList.DataSource = List;
        this.rptrList.DataBind();

    }
    //绑定事件
    protected void rptrList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            FMDS_Water_IrrigaDrainageStatInfo drv = (FMDS_Water_IrrigaDrainageStatInfo)e.Item.DataItem;



            if (string.IsNullOrEmpty(drv.PumpModel) && string.IsNullOrEmpty(drv.PumpManu) && drv.PumpUnits == int.MinValue && drv.PumpTime.ToString() == "1900/1/1 0:00:00" && drv.PumpPower == int.MinValue)
            {
                Label lblPumpUnits = (Label)e.Item.FindControl("lblPumpUnits");

                lblPumpUnits.Text = "0";
                Ss += 0;

            }
            else
            {
                Label lblPumpUnits = (Label)e.Item.FindControl("lblPumpUnits");

                lblPumpUnits.Text = "1";
                Ss += 1;
            }


            if (string.IsNullOrEmpty(drv.EquipType) && string.IsNullOrEmpty(drv.MachManuf) && drv.MachUnits == int.MinValue && drv.MachTime.ToString() == "1900/1/1 0:00:00" && drv.PowerEquip == int.MinValue)
            {
                Label lblMachUnits = (Label)e.Item.FindControl("lblMachUnits");

                lblMachUnits.Text = "0";
                Js += 0;

            }
            else
            {
                Label lblMachUnits = (Label)e.Item.FindControl("lblMachUnits");

                lblMachUnits.Text = "1";
                Js += 1;

            }
            Gg += drv.IrrigaDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.IrrigaDesign);
            Km += drv.ConArea == int.MinValue ? 0 : Convert.ToDecimal(drv.ConArea);

            if (drv.IrrigaDesign != 0 && drv.IrrigaDesign != int.MinValue)
            {
                Ggs++;
            }
            Cm += drv.ConstruArea == int.MinValue ? 0 : Convert.ToDecimal(drv.ConstruArea);

            Nj += drv.AnnopeTime == int.MinValue ? 0 : Convert.ToDecimal(drv.AnnopeTime);
            Nh += drv.AveragePower == int.MinValue ? 0 : Convert.ToDecimal(drv.AveragePower);
            Ggxs += drv.TotalIrriDes == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalIrriDes);
            Ggxx += drv.TotalIrriSta == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalIrriSta);
            Ggss += drv.PaddyDes == int.MinValue ? 0 : Convert.ToDecimal(drv.PaddyDes);
            Ggsx += drv.IrigaSta == int.MinValue ? 0 : Convert.ToDecimal(drv.IrigaSta);
            Gghs += drv.IrriDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.IrriDesign);
            Gghx += drv.IrriStat == int.MinValue ? 0 : Convert.ToDecimal(drv.IrriStat);
            Plxs += drv.TotalDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalDesign);
            Plxx += drv.TotalSitua == int.MinValue ? 0 : Convert.ToDecimal(drv.TotalSitua);
            Plhs += drv.DryDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.DryDesign);
            Plhx += drv.GlebeStatus == int.MinValue ? 0 : Convert.ToDecimal(drv.GlebeStatus);
            Plss += drv.PaddyDesign == int.MinValue ? 0 : Convert.ToDecimal(drv.PaddyDesign);
            Plsx += drv.DrainSitua == int.MinValue ? 0 : Convert.ToDecimal(drv.DrainSitua);
            Tc += drv.InitialWork == int.MinValue ? 0 : Convert.ToDecimal(drv.InitialWork);
            Tl += drv.EarthCumula == int.MinValue ? 0 : Convert.ToDecimal(drv.EarthCumula);
            Sc += drv.StoneInit == int.MinValue ? 0 : Convert.ToDecimal(drv.StoneInit);
            Sl += drv.StoneWork == int.MinValue ? 0 : Convert.ToDecimal(drv.StoneWork);
            Gc += drv.IniConSqu == int.MinValue ? 0 : Convert.ToDecimal(drv.IniConSqu);
            Gl += drv.ConcrCumula == int.MinValue ? 0 : Convert.ToDecimal(drv.ConcrCumula);
            Hc += drv.RaisedTotal == int.MinValue ? 0 : Convert.ToDecimal(drv.RaisedTotal);
            Hl += drv.SccumulaTotal == int.MinValue ? 0 : Convert.ToDecimal(drv.SccumulaTotal);
            Gtc += drv.Sinitial == int.MinValue ? 0 : Convert.ToDecimal(drv.Sinitial);
            Gtl += drv.Sccumula == int.MinValue ? 0 : Convert.ToDecimal(drv.Sccumula);
            Zc += drv.Initialself == int.MinValue ? 0 : Convert.ToDecimal(drv.Initialself);
            Zl += drv.Raised == int.MinValue ? 0 : Convert.ToDecimal(drv.Raised);

        }

    }
    
    protected override void Render(HtmlTextWriter writer)
    {

        if (List.Count != 1 && List.Count != 0)
        {
            Label lblIrrigaDesign = (Label)rptrList.Items[0].FindControl("lblIrrigaDesign");
            if (Ggs != 0)
            {

                lblIrrigaDesign.Text = (Gg / Ggs).ToString();
            }

            Label lblConArea = (Label)rptrList.Items[0].FindControl("lblConArea");

            lblConArea.Text = Km.ToString();


            Label lblConstruArea = (Label)rptrList.Items[0].FindControl("lblConstruArea");

            lblConstruArea.Text = Cm.ToString();


            Label lblAnnopeTime = (Label)rptrList.Items[0].FindControl("lblAnnopeTime");

            lblAnnopeTime.Text = Nj.ToString();

            Label lblPumpUnits = (Label)rptrList.Items[0].FindControl("lblPumpUnits");

            lblPumpUnits.Text = (Ss).ToString();


            Label lblMachUnits = (Label)rptrList.Items[0].FindControl("lblMachUnits");

            lblMachUnits.Text = (Js).ToString();
            Label lblAveragePower = (Label)rptrList.Items[0].FindControl("lblAveragePower");

            lblAveragePower.Text = (Nh).ToString();
            Label lblTotalDesign = (Label)rptrList.Items[0].FindControl("lblTotalDesign");

            lblTotalDesign.Text = Plxs.ToString();
            Label lblTotalSitua = (Label)rptrList.Items[0].FindControl("lblTotalSitua");
            lblTotalSitua.Text = Plxx.ToString();
            Label lblDryDesign = (Label)rptrList.Items[0].FindControl("lblDryDesign");

            lblDryDesign.Text = Plhs.ToString();
            Label lblGlebeStatus = (Label)rptrList.Items[0].FindControl("lblGlebeStatus");

            lblGlebeStatus.Text = Plhx.ToString();
            Label lblPaddyDesign = (Label)rptrList.Items[0].FindControl("lblPaddyDesign");
            lblPaddyDesign.Text = Plss.ToString();
            Label lblDrainSitua = (Label)rptrList.Items[0].FindControl("lblDrainSitua");
            lblDrainSitua.Text = Plsx.ToString();
            Label lblTotalIrriDes = (Label)rptrList.Items[0].FindControl("lblTotalIrriDes");

            lblTotalIrriDes.Text = Ggxs.ToString();
            Label lblTotalIrriSta = (Label)rptrList.Items[0].FindControl("lblTotalIrriSta");
            lblTotalIrriSta.Text = Ggxx.ToString();
            Label lblIrriDesign = (Label)rptrList.Items[0].FindControl("lblIrriDesign");

            lblIrriDesign.Text = Gghs.ToString("0.00");


            Label lblIrriStat = (Label)rptrList.Items[0].FindControl("lblIrriStat");

            lblIrriStat.Text = Gghx.ToString();


            Label lblPaddyDes = (Label)rptrList.Items[0].FindControl("lblPaddyDes");

            lblPaddyDes.Text = Ggss.ToString();




            Label lblIrigaSta = (Label)rptrList.Items[0].FindControl("lblIrigaSta");

            lblIrigaSta.Text = Ggsx.ToString();


            Label lblEarthCumula = (Label)rptrList.Items[0].FindControl("lblEarthCumula");

            lblEarthCumula.Text = Tl.ToString();
            Label lblInitialWork = (Label)rptrList.Items[0].FindControl("lblInitialWork");
            lblInitialWork.Text = Tc.ToString();
            Label lblStoneWork = (Label)rptrList.Items[0].FindControl("lblStoneWork");
            lblStoneWork.Text = Sl.ToString();
            Label lblStoneInit = (Label)rptrList.Items[0].FindControl("lblStoneInit");
            lblStoneInit.Text = Sc.ToString();
            Label lblConcrCumula = (Label)rptrList.Items[0].FindControl("lblConcrCumula");
            lblConcrCumula.Text = Gl.ToString();
            Label lblIniConSqu = (Label)rptrList.Items[0].FindControl("lblIniConSqu");
            lblIniConSqu.Text = Gc.ToString();
            Label lblSccumulaTotal = (Label)rptrList.Items[0].FindControl("lblSccumulaTotal");
            lblSccumulaTotal.Text = Hl.ToString();
            Label lblRaisedTotal = (Label)rptrList.Items[0].FindControl("lblRaisedTotal");
            lblRaisedTotal.Text = Hc.ToString();
            Label lblSccumula = (Label)rptrList.Items[0].FindControl("lblSccumula");
            lblSccumula.Text = Gtl.ToString();
            Label lblSinitial = (Label)rptrList.Items[0].FindControl("lblSinitial");

            lblSinitial.Text = Gtc.ToString();
            Label lblRaised = (Label)rptrList.Items[0].FindControl("lblRaised");

            lblRaised.Text = Zl.ToString();


            Label lblInitialself = (Label)rptrList.Items[0].FindControl("lblInitialself");

            lblInitialself.Text = Zc.ToString();
        }

        Label lblYear1 = (Label)rptrList.Items[0].FindControl("lblYear");

        lblYear1.Text = " ";

        base.Render(writer);

    }
    //绑定事件
    public void BindGrid()
    {
        plResult.Visible = true;
        QueryBuilder queryBuilder = new QueryBuilder();

        if (!string.IsNullOrEmpty(ddlSubOrgID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "in", "(select OrganiseUnitID from SDMS_OrganiseUnit where OrganiseUnitCode like '%'+(select OrganiseUnitCode from SDMS_OrganiseUnit where OrganiseUnitID=" + CurrentUserInfo.OrgID + ")+'%' and OrganiseUnitModel=1 and IsDelete=0)", FilterType.Unknown);
        }
        if (!string.IsNullOrEmpty(ddlOrganiseUnitID.SelectedValue))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ORGANISEUNITID_FIELD, "=", ddlOrganiseUnitID.SelectedValue);
        }
        if (!string.IsNullOrEmpty(txtPumpingName.Text.Trim()))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.PUMPINGNAME_FIELD, "LIKE", txtPumpingName.Text.Trim());
        }
        if (!string.IsNullOrEmpty(txtStartDate.Text.Trim()))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD, ">=", txtStartDate.Text.Trim());
        }
        if (!string.IsNullOrEmpty(txtEndDate.Text.Trim()))
        {
            queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD, "<=", txtEndDate.Text.Trim());
        }

        queryBuilder.AddFilter(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.ISDELETE_FIELD, "=", 0);

        queryBuilder.AddOrderASC(SDMS_OrganiseUnitInfo.SDMS_ORGANISEUNIT_TABLE, SDMS_OrganiseUnitInfo.DISPLAYINDEX_FIELD);

        queryBuilder.AddOrderDESC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.CREATEDYEAR_FIELD);
        queryBuilder.AddOrderASC(FMDS_Water_IrrigaDrainageStatInfo.FMDS_WATER_IRRIGADRAINAGESTAT_TABLE, FMDS_Water_IrrigaDrainageStatInfo.PUMPINGNAME_FIELD);
        FMDS_Water_IrrigaDrainageStatBLL bll = new FMDS_Water_IrrigaDrainageStatBLL();


        List = bll.GetModelListBySql1(queryBuilder);
        FMDS_Water_IrrigaDrainageStatInfo m = new FMDS_Water_IrrigaDrainageStatInfo { OrganiseUnitName = "统计" };
        List.Insert(0, m);
        this.rptrList.DataSource = List;
        this.rptrList.DataBind();

    }
    //查询按钮
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {

            BindGrid();
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
    protected void btnOutExcel_Click(object sender, EventArgs e)
    {
        ExcelOut(this.rptrList);

    }


    
      
    

    public void ExcelOut(Repeater gv)
    {

        if (gv.Items.Count > 0)
        {

            Response.Clear();

            Response.ClearContent();

            Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xls");

            Response.ContentEncoding = System.Text.Encoding.UTF8;

            Response.ContentType = "application/ms-excel";

            StringWriter sw = new StringWriter();

            HtmlTextWriter htw = new HtmlTextWriter(sw);

            gv.RenderControl(htw);

            Response.Write(sw.ToString());

            Response.Flush();

            Response.End();

        }

        else
        {

            Response.Write("没有数据");

        }

    }

    public override void VerifyRenderingInServerForm(System.Web.UI.Control control)
    {

        //base.VerifyRenderingInServerForm(control);        

    }

    


}
博学多思 | 园豆:76 (初学一级) | 2015-09-29 10:18

 @潘雪婷: 

还是一样的效果

博学多思 | 园豆:76 (初学一级) | 2015-09-29 10:19

@博学多思: 你这么复杂的报表估计不能这样导出,因为你还有合并单元格,你试试用npoi

潘雪婷 | 园豆:204 (菜鸟二级) | 2015-09-29 10:20

@潘雪婷: 具体怎么整?详细讲解

博学多思 | 园豆:76 (初学一级) | 2015-09-29 10:20

@博学多思: 可以告诉我你的QQ吗,这样讲很不方便,不要想歪,我真的只是想帮你解决

潘雪婷 | 园豆:204 (菜鸟二级) | 2015-09-29 10:22

@潘雪婷: 1658026873.

博学多思 | 园豆:76 (初学一级) | 2015-09-29 10:23

@潘雪婷: 

   <asp:UpdatePanel ID="uplQueryCondion" runat="server" >
                <ContentTemplate>
                    <asp:Panel runat="server" ID="plResult" CssClass="panel">
                        <div class="title">查询结果</div>
                      <div class="content"  style="overflow-x:auto;overflow-y:hidden;padding-bottom:17px;">
                            <table border="0" class="kttable1" >
                                <asp:Repeater ID="rptrList" runat="server" OnItemDataBound="rptrList_ItemDataBound">
                                    <HeaderTemplate>
                                    
                                        <tr>
                                            <th rowspan="3"  >单位</th>
                                            <th rowspan="3"  >水库名称</th>
                                               
                                            <th rowspan="3"  ><nobr>建设</nobr>地点</th>
                                              
                                             <th rowspan="3"  ><nobr>工程</nobr>等级</th>
                                              
                                             <th rowspan="3"  ><nobr>所在</nobr>
                                               河流</th>
                                             <th rowspan="3"  ><nobr>设计</nobr>单位</th>
                                             <th rowspan="3"  ><nobr>建设</nobr>时间</th>
                                            <th rowspan="3"  ><nobr>已用(年)</nobr></th>
                                                  <th rowspan="3"  ><nobr>建设</nobr>单位</th>

                                               <th rowspan="3"  ><nobr>运行</nobr>情况</th>
                                            <th colspan="12"  >水位(米)</th>
                                        
                                              <th rowspan="3"><nobr>集水</nobr>面积</th>
                                         
                                        
                                            <th colspan="10">库容(万立方米)</th>
                                           <th colspan="4">输水洞</th>
                                            <th rowspan="3"> 个数</th>
                                              
                                            <th colspan="2" >溢洪道</th>
                                              <th colspan="9" >工程量(万立方米)</th>
                                             <th colspan="11" >防洪效益</th>
                                         <th colspan="6" >灌溉(万亩)</th>
                                             <th colspan="4" >发电</th>
                                               <th colspan="2" >供水(万立方米/年)</th>
                                             <th colspan="3" >养鱼</th>

                                        </tr>
                                        <tr>
                                             <th colspan="2">死水位</th>
                                            <th colspan="2">兴利水位</th>
                                             <th colspan="2">设计洪水位 </th>
                                               <th colspan="2">校核洪水位 </th>
                                            <th colspan="2">防洪限制水位 </th>
                                            <th colspan="2">最高洪水位</th>
                                                 <th colspan="2">总库容</th>
                                       <th colspan="2">死库容</th>
                                               <th colspan="2">兴利库容</th>
                                              <th colspan="2">设计防洪库容</th>
                                             <th colspan="2">校核防洪库容</th>
                                             <th colspan="2">孔数(孔)</th>
                                            <th colspan="2">流量(立方米/秒)</th>
                                              <th colspan="2">最大溢流量(立方米/秒)</th>
                                                <th colspan="4">设计</th>
                                             <th colspan="4">已完成</th>
                                              <th rowspan="2">其他</th>
                                            <th colspan="4">保护面积(万亩)</th>
                                            <th >人口(万人)</th>
                                            <th >居民点(处)</th>
                                             <th >公路(千米/条)</th>
                                              <th >铁路(千米/条)</th>
                                               <th >工农业产值</th>
                                            <th >固定资产(万元)</th>
                                             <th >其他</th>
                                            <th  colspan="2">合计</th>
                                             <th  colspan="2">水田</th>
                                               <th  colspan="2">旱田</th>
                                              <th  colspan="2">装机容量</th>

                                        </tr>

                                        <tr>
                                            <th>设计</th>
                                            <th>现状</th>
                                             <th>设计</th>
                                            <th>现状</th>
                                              <th>设计</th>
                                            <th>现状</th>
                                              <th>设计</th>
                                            <th>现状</th>
                                              <th>设计</th>
                                            <th>现状</th>
                                              <th>设计</th>
                                            <th>现状</th>
                                               <th>初始</th>
                                            <th>累计</th>
                                             <th>初始</th>
                                            <th>累计</th>
                                             <th>初始</th>
                                            <th>累计</th>
                                            <th>初始</th>
                                            <th>累计</th>
                                            <th>初始</th>
                                            <th>累计</th>
                                            <th>初始</th>
                                            <th>累计</th>
                                        </tr>
                                    </HeaderTemplate>
                                    <ItemTemplate>

                                        <td style="text-align:center" >
                                            <nobr><%# Eval("OrganiseUnitName").ToString() %></nobr>
                                        </td>
                                        <td  style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" ID="lblPumpingName" Text='<%#Eval("PumpingName")==null?string.Empty:Eval("PumpingName").ToString() %>'  ></asp:Label>&nbsp;</td>
                                        <td  style="text-align:left" >
                                            <asp:Label runat="server" Text='<%#Eval("ProLocat")==null?string.Empty:Eval("ProLocat").ToString() %>' ID="lblProLocat" ></asp:Label>&nbsp;</td>
                                        <td  style="word-wrap : break-word ;text-align:left">
                                            <asp:Label runat="server" Text='<%# Eval("Enggrade")==null?string.Empty:Eval("Enggrade").ToString() %>' ID="lblEnggrade" ></asp:Label>&nbsp;</td>
                                        <td  style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("CreatedYear"))==int.MinValue?string.Empty:Eval("CreatedYear").ToString()%>' ID="lblCreatedYear" ></asp:Label>&nbsp;</td>
                                        
                                          <td  style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Eval("IrriqWater")==null?string.Empty:Eval("IrriqWater").ToString() %>' ID="lblIrriqWater" ></asp:Label>&nbsp;</td>

                                         <td  style="word-wrap : break-word ; text-align:left" >
                                            <asp:Label runat="server" Text='<%#DateTime.Now.Year-Convert.ToInt32( Eval("CreatedYear"))==null?string.Empty:(DateTime.Now.Year-Convert.ToInt32( Eval("CreatedYear"))).ToString()    %>' ID="lblYear"></asp:Label>&nbsp;</td>


                                         </td>
                                          <td style="text-align:left"><asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("DesignFlow")) ==int.MinValue?string.Empty:Eval("DesignFlow").ToString()  %>' ID="Label2"></asp:Label>&nbsp;</td>
                                        <td style="text-align:left">
                                        <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("DesignFlowP")) ==int.MinValue?string.Empty:Eval("DesignFlowP").ToString()  %>' ID="Label3"></asp:Label>&nbsp;</td>
                                      

                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("StatDesign")) ==int.MinValue?string.Empty:Eval("StatDesign").ToString()  %>' ID="lblStatDesign"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("SituaDesign"))==int.MinValue?string.Empty:Eval("SituaDesign").ToString() %>' ID="lblSituaStatus"></asp:Label>&nbsp;</td>


                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("LiftsDesign"))   ==int.MinValue?string.Empty:Eval("LiftsDesign").ToString()%>' ID="lblLiftsDesign"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("HeadDesign"))==int.MinValue?string.Empty:Eval("HeadDesign").ToString() %>' ID="lblHeadDesign"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                             <asp:Label runat="server" Text='<%# Eval("InfrastruType")==null?string.Empty:Eval("InfrastruType").ToString() %>' ID="lblInfrastruType" ></asp:Label>&nbsp;</td>
                                           <td style="word-wrap : break-word ; text-align:left">
                                         <asp:Label runat="server" Text='<%#Eval("DrainDesign")==null?string.Empty:Eval("DrainDesign").ToString() %>' ID="Label1" ></asp:Label>&nbsp;</td>
                                   
                                        <td style="word-wrap : break-word ; text-align:left">
                                              <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("IrrigaDesign")) ==int.MinValue?string.Empty:Eval("IrrigaDesign").ToString()  %>' ID="lblIrrigaDesign"></asp:Label>&nbsp;</td>
                                         <td style="word-wrap : break-word ; text-align:left">
                                    
                                             <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("ConArea")) ==int.MinValue?string.Empty:Eval("ConArea").ToString()  %>' ID="lblConArea"></asp:Label>&nbsp;
                                       
                                       
                                       
                                     
                                      
                                        
                                      <td style="word-wrap : break-word ; text-align:left">
                                           

                                         <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("PumpUnits")) ==int.MinValue?string.Empty:Eval("PumpUnits").ToString()  %>' ID="lblPumpUnits"></asp:Label>&nbsp;</td>                                   
                                       <td style="word-wrap : break-word ; text-align:left">
                                               <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("PowerEquip")) ==int.MinValue?string.Empty:Eval("PowerEquip").ToString()  %>' ID="lblMachUnits"></asp:Label>&nbsp;</td>
                                          

                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("ConstruArea"))  ==int.MinValue?string.Empty:Eval("ConstruArea").ToString()    %>' ID="lblConstruArea"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("AnnopeTime"))  ==int.MinValue?string.Empty:Eval("AnnopeTime").ToString()    %>' ID="lblAnnopeTime"></asp:Label>&nbsp;</td>




                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("AveragePower"))   ==int.MinValue?string.Empty:Eval("AveragePower").ToString()    %>' ID="lblAveragePower"></asp:Label>&nbsp;</td>

                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("TotalDesign"))   ==int.MinValue?string.Empty:Eval("TotalDesign").ToString()    %>' ID="lblTotalDesign"></asp:Label>&nbsp;</td>


                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("TotalSitua"))   ==int.MinValue?string.Empty:Eval("TotalSitua").ToString()    %>' ID="lblTotalSitua"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("DryDesign"))==int.MinValue?string.Empty:Eval("DryDesign").ToString() %>' ID="lblDryDesign"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("GlebeStatus")) ==int.MinValue?string.Empty:Eval("GlebeStatus").ToString() %>' ID="lblGlebeStatus"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("PaddyDesign"))==int.MinValue?string.Empty:Eval("PaddyDesign").ToString() %>' ID="lblPaddyDesign"></asp:Label>&nbsp;</td>



                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("DrainSitua"))   ==int.MinValue?string.Empty:Eval("DrainSitua").ToString()    %>' ID="lblDrainSitua"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("TotalIrriDes"))==int.MinValue?string.Empty:Eval("TotalIrriDes").ToString() %>' ID="lblTotalIrriDes"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("TotalIrriSta")) ==int.MinValue?string.Empty:Eval("TotalIrriSta").ToString()  %>' ID="lblTotalIrriSta"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("IrriDesign"))==int.MinValue?string.Empty:Eval("IrriDesign").ToString() %>' ID="lblIrriDesign"></asp:Label>&nbsp;</td>





                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("IrriStat"))   ==int.MinValue?string.Empty:Eval("IrriStat").ToString()    %>' ID="lblIrriStat"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("PaddyDes"))==int.MinValue?string.Empty:Eval("PaddyDes").ToString() %>' ID="lblPaddyDes"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("IrigaSta")) ==int.MinValue?string.Empty:Eval("IrigaSta").ToString()  %>' ID="lblIrigaSta"></asp:Label>&nbsp;</td>
                                      
                                                <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("InitialWork"))   ==int.MinValue?string.Empty:Eval("InitialWork").ToString()    %>' ID="lblInitialWork"></asp:Label>&nbsp;</td>
                                                <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("EarthCumula"))==int.MinValue?string.Empty:Eval("EarthCumula").ToString() %>' ID="lblEarthCumula"></asp:Label>&nbsp;</td>

                                       <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("StoneInit")) ==int.MinValue?string.Empty:Eval("StoneInit").ToString()  %>' ID="lblStoneInit"></asp:Label>&nbsp;</td>
                                            
                                       <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("StoneWork"))==int.MinValue?string.Empty:Eval("StoneWork").ToString() %>' ID="lblStoneWork"></asp:Label>&nbsp;</td>
                                      
                                              
                                                <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("IniConSqu"))   ==int.MinValue?string.Empty:Eval("IniConSqu").ToString()    %>' ID="lblIniConSqu"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("ConcrCumula"))==int.MinValue?string.Empty:Eval("ConcrCumula").ToString() %>' ID="lblConcrCumula"></asp:Label>&nbsp;</td>

                                              <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("RaisedTotal"))==int.MinValue?string.Empty:Eval("RaisedTotal").ToString() %>' ID="lblRaisedTotal"></asp:Label>&nbsp;</td>
                                     
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("SccumulaTotal"))==int.MinValue?string.Empty:Eval("SccumulaTotal").ToString() %>' ID="lblSccumulaTotal"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("Sinitial"))   ==int.MinValue?string.Empty:Eval("Sinitial").ToString()    %>' ID="lblSinitial"></asp:Label>&nbsp;</td>
                                        <td style="word-wrap : break-word ; text-align:left" >
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("Sccumula"))==int.MinValue?string.Empty:Eval("Sccumula").ToString() %>' ID="lblSccumula"></asp:Label>&nbsp;</td>


                                                <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("Initialself"))==int.MinValue?string.Empty:Eval("Initialself").ToString() %>' ID="lblInitialself"></asp:Label>&nbsp;</td>
                                       
                                        <td style="word-wrap : break-word ; text-align:left">
                                            <asp:Label runat="server" Text='<%# Convert.ToDecimal(Eval("Raised"))==int.MinValue?string.Empty:Eval("Raised").ToString() %>' ID="lblRaised"></asp:Label>&nbsp;</td>
                                     
                                       </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </table>
                            <div>
                                <asp:Label ID="lblError" runat="server" CssClass="ErrLabel" />&nbsp;&nbsp; </div>
                        </div>
                    </asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
博学多思 | 园豆:76 (初学一级) | 2015-09-29 10:28
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册