ASP.NET GridView如何取消更新

时间:2011-08-27 11:01:35

标签: asp.net events gridview

我有连接SqlDataSource的GridView,我希望在OnRowUpdating事件中我的条件为false时取消更新行?怎么做?谢谢。

1 个答案:

答案 0 :(得分:5)

尝试

protected void Page_Load(object sender, EventArgs e)
    {
        GridView1.RowUpdating += new GridViewUpdateEventHandler(GridView1_RowUpdating);
    }

    void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
          e.Cancel = true;
    }