GridView控件批量更新
CS代码:
    protected void ButtontBatchPrice_Click(object sender, EventArgs e)
    {
        CheckBox cb=new CheckBox();
        for (int i = 0; i < GridView1.Rows.Count;i++ )
        {
            cb = (GridView1.Rows[i].Cells[7].FindControl("CheckBox1") as CheckBox);
            if (cb.Checked)
            {
                HiddenField hf=new HiddenField();
                hf=GridView1.Rows[i].Cells[7].FindControl("HiddenField1") as HiddenField;
                Price_LFacade_Web.UpdatePrice(hf.Value, Convert.ToDecimal(GridView1.Rows[i].Cells[2].Text), Convert.ToDecimal(GridView1.Rows[i].Cells[2].Text), Convert.ToDecimal(GridView1.Rows[i].Cells[2].Text), Convert.ToDecimal(GridView1.Rows[i].Cells[2].Text));
            }
        }
    }

    public static void UpdatePrice(string ObjectId, decimal OnlineBidPrice, decimal OnlineSellPrice, decimal OrderBidPrice, decimal OrderSellPrice)
    {
        //更新失败情况未做处理,日后完善
        Price_LFacade tmpPrice = new Price_LFacade(ObjectId);
        String blockName = System.Guid.NewGuid().ToString();
        WebUndoBlockHelper.StartUndoBlock(blockName);
        tmpPrice.QuoteScenario.ModifyPriceAndProfitMargin(tmpPrice.GoodsSubjectId, tmpPrice.ProfitMargin, OrderSellPrice, OnlineSellPrice, tmpPrice.PriceUnit);
        WebUndoBlockHelper.UpdateBlock(blockName);
    }

HTML代码
<body>
    <form ></asp:ObjectDataSource>
        &nbsp;
    </form>
</body>

相关文章: