2014年6月9日 星期一

ASP.NET Gridview Edit 按兩次才能編輯解決方法

ASP.NET Gridview Edit 按兩次才能編輯解決方法

C#:
  1. protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
  2. {
  3. try
  4. {
  5. //1.重新綁定
  6. GridView1.EditIndex = e.NewEditIndex;
  7. //2.重新DataBind
  8. Gvlistitem.DataSource = dt;
  9. GridView1.DataBind();
  10. }
  11. catch (Exception)
  12. {
  13. throw;
  14. }
  15. }

沒有留言:

張貼留言