protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int index = int.Parse(e.CommandArgument.ToString());
if (e.CommandName == "Del")
{
int userId = Convert.ToInt32(GridView1.DataKeys[index].Values[0].ToString());
if (userBll.DelUser(userId))
{
Response.Redirect("List.aspx");
}
}
else if(e.CommandName == "Edit")
{ int userId = Convert.ToInt32(GridView1.DataKeys[index].Value.ToString());
Response.Redirect("user_Edit.aspx?userId=" + userId);
}
}
{
int index = int.Parse(e.CommandArgument.ToString());
if (e.CommandName == "Del")
{
int userId = Convert.ToInt32(GridView1.DataKeys[index].Values[0].ToString());
if (userBll.DelUser(userId))
{
Response.Redirect("List.aspx");
}
}
else if(e.CommandName == "Edit")
{ int userId = Convert.ToInt32(GridView1.DataKeys[index].Value.ToString());
Response.Redirect("user_Edit.aspx?userId=" + userId);
}
}
解决方案 »
- 高手指教 在线等 动态添加表格!高手指点 谢谢!
- javascript:一个Div,当Div在窗体显示不下时,自动调整窗体以显示Div,移动的时候同样
- Get/Set 属性存取器和 public string 有什么区别
- 用Javascript怎么连接两个数字 如1+1=11
- ******** Forms验证跳转问题,朋友们帮忙看看,在线,迅速揭帖 *************
- 百分求教:如何做才可将freetextbox中的图片上传到服务器?(急啊)
- 关于Microsoft.Office.Interop.Excel的问题
- 毕业了两年没接触过编程,没的项目经验。现在该从何做起?求推荐好的书籍~
- 如何下载多张图片?
- 微软的".NET frameWork SDK 快速入门、教程和示例"怎么不能用啊!!!!!!!!!
- datalist绑定并选择性显示的问题
- 谁有在线编辑器支持插入公式和excela啊
看下GridView1.DataKeys.count 。
int userId = Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value);