Response.Write(GridView1.DataKeys[e.RowIndex].ToString());抛出ArgumentOutOfRangeException异常求解

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 05:54:10
Response.Write(GridView1.DataKeys[e.RowIndex].ToString());抛出ArgumentOutOfRangeException异常求解
x) J-.+N /,Ip/L L-7sI,IN,N /KI .)KԴ~5i.ǢԼļT׊Ԃ{lcӋmf~ }}l˚]|V =/.zڿOxɎUO;

Response.Write(GridView1.DataKeys[e.RowIndex].ToString());抛出ArgumentOutOfRangeException异常求解
Response.Write(GridView1.DataKeys[e.RowIndex].ToString());抛出ArgumentOutOfRangeException异常求解

Response.Write(GridView1.DataKeys[e.RowIndex].ToString());抛出ArgumentOutOfRangeException异常求解
比如你的DataKeys里面只保存了2个列的值,你e.RowIndex取到的是第几行.正确的作法应该是
GridView1.DataKeys[0].Values[e.RowIndex]类似这种