'GridViewDeletedEventArgs '末包含' RowIndex "的定义,并且找不到可接受第一 个"GridViewDeletedEventArgs类型参数的扩展方法RowIndex "(是否缺少using指令或程序集引用?)
页面中设置了“ OnRowDeleting="List_RowDeleting" DataKeyNames="id"”
后台代码为:
行 178: protected void List_RowDeleting(object sender, GridViewDeletedEventArgs e)
行 179: {
行 180: string id = this.List.DataKeys[e.RowIndex].Value.ToString();
行 181: SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRING"].ConnectionString);
行 182: con.Open();
后台代码为:
行 178: protected void List_RowDeleting(object sender, GridViewDeletedEventArgs e)
行 179: {
行 180: string id = this.List.DataKeys[e.RowIndex].Value.ToString();
行 181: SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRING"].ConnectionString);
行 182: con.Open();
原因:参数错误,应该是GridViewDeleteEventArgs
RowDeleted事件是GridViewDeletedEventArgs
RowDeleting事件是GridViewDeleteEventArgs
RowDeleting事件是GridViewDeleteEventArgs