Gridview点击两次才进入编辑模式

时间:2022-11-23 14:46:00

需要重新再Grid_rowEditi

public void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
            DataTable dt = new DataTable();
            DataColumn dcName = dt.Columns.Add("Intro");
            dcName.DataType = Type.GetType("System.String");
            DataRow dr = dt.NewRow();
            dr[0] = "test";
            dt.Rows.Add(dr);
            GridView1.DataSource = dt;
            GridView1.EditIndex = e.NewEditIndex;
            GridView1.DataBind();
    }

  

ng()事件中重新绑定datasource;和写入index