protected void roleGrid_Update(object sender, GridViewUpdatedEventArgs e)
{
GridViewRow myrow = GridView1.Rows;
string id = ((TextBox)myrow.Cells[1].Controls[0]).Text;
string name = ((TextBox)myrow.Cells[2].Controls[0]).Text;
string myConn = ConfigurationManager.AppSettings["connString1"];
SqlConnection conn = new SqlConnection(myConn);
conn.Open();
string sql = "update role set roleId='"+id+"',roleName='"+name+"' ";
SqlCommand cmd = new SqlCommand(sql,conn);
try
{
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
conn.Close();
BindGrid();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}////////////////////////////////////////////////////////////////
还有我的GridViewUpdatedEventArgs 类中也没有EditIndex属性。
这是怎么回事啊?在线等!
{
GridViewRow myrow = GridView1.Rows;
string id = ((TextBox)myrow.Cells[1].Controls[0]).Text;
string name = ((TextBox)myrow.Cells[2].Controls[0]).Text;
string myConn = ConfigurationManager.AppSettings["connString1"];
SqlConnection conn = new SqlConnection(myConn);
conn.Open();
string sql = "update role set roleId='"+id+"',roleName='"+name+"' ";
SqlCommand cmd = new SqlCommand(sql,conn);
try
{
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
conn.Close();
BindGrid();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}////////////////////////////////////////////////////////////////
还有我的GridViewUpdatedEventArgs 类中也没有EditIndex属性。
这是怎么回事啊?在线等!
GridViewUpdateEventArgs本来就没有EditIndex属性~
protected void roleGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}试试
上面那行也有错误。
提示GridView1无法隐式转换类型。