日期:2014-05-18  浏览次数:20499 次

gridView 在 数据绑定时 获取行的状态为 ListItemType.EditItem 怎么获取啊
如下代码的功能

protected void grid_list_RowDataBound(object sender, GridViewRowEventArgs e)
  {  
  // if (e.Row.RowType == ListItemType.EditItem)
  // {
  // TextBox TXT_budget_money = (TextBox)(e.Row.FindControl("txt_budget_money"));
  // TXT_budget_money.ReadOnly = true;
  // }  
  }
在VS2003种的 ItemDataBound 事件可以为
if( e.Item.ItemType == ListItemType.EditItem )
{
//
}

我在 VS2005种找不到,不知道怎么做了

------解决方案--------------------
楼主是不是要获取gridview中编辑状态的row?

试试这个
protected void grid_list_RowDataBound(object sender, GridViewRowEventArgs e) 
{
if (e.Row.RowState== DataControlRowState.Edit) 

//do some thing
}


其他的还有DataControlRowState.Alternate,DataControlRowState.Insert,DataControlRowState.Normal,DataControlRowState.Selected都可以取到