3

这是我的代码,我想从数据库中获取值并插入转发器,此代码仅返回数据库中的最后一个值

for (int i = 0; i < dtFinalVessel.Rows.Count; i++)          
    if (i == 0)
    {
        if (e.Item.ItemType == ListItemType.Item)
        {

            DataTable dtCostElement = DAL.MonthlyCrudeAccrualsDetail.GetMonthlyCrudeAccrualsPerFinalBolID_Get_List(int.Parse(dtFinalVessel.Rows[0]["FinalVesselPerBOLID"].ToString()));

            ArrayList arrlist = new ArrayList();

            Repeater rptrCostElementHeader = (Repeater)e.Item.FindControl("rptrCostElementHeader");
            rptrCostElementHeader.DataSource = dtCostElement;
            rptrCostElementHeader.DataBind();

            Repeater rptrUS = (Repeater)e.Item.FindControl("rptrUS");
            rptrUS.DataSource = dtCostElement;
            rptrUS.DataBind();

            Repeater rptrZAR = (Repeater)e.Item.FindControl("rptrZAR");
            rptrZAR.DataSource = dtCostElement;
            rptrZAR.DataBind();


            Repeater rptrUSCent = (Repeater)e.Item.FindControl("rptrUSCent");
            rptrUSCent.DataSource = dtCostElement;
            rptrUSCent.DataBind();

            for (int j = 0; j < dtCostElement.Rows.Count; j++)
            {
                string strUscent = dtCostElement.Rows[j]["USCent"].ToString();
                decimal total = decimal.Parse(strUscent.ToString()) / decimal.Parse(hdnTotalVessel.Value.ToString());
                arrlist.Add(total.ToString());
            }
            Repeater rptAvgUSCent = (Repeater)e.Item.FindControl("rptAvgUSCent");
            rptAvgUSCent.DataSource = arrlist;
            rptAvgUSCent.DataBind();`


        }
    }     
}
4

0 回答 0