控制编辑文本框大小的方法
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//如果使用if (e.Row.RowState == DataControlRowState.Edit)作为判断条件,那么如果当前行恰好是交替行时,条件不成立-即便当前行确实也处于编辑状态*/
if ((e.Row.RowState & DataControlRowState.Edit) != 0)
{
TextBox txt1 = e.Row.Cells[1].Controls[0] as TextBox;
txt1.Width = 200;
TextBox txt2 = e.Row.Cells[2].Controls[0] as TextBox;
txt2.Width = 200;
}
}
本文地址:http://www.45fan.com/a/question/69788.html