Chinaunix首页 | 论坛 | 博客
  • 博客访问: 69333
  • 博文数量: 29
  • 博客积分: 1500
  • 博客等级: 上尉
  • 技术积分: 270
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-12 14:09
文章分类

全部博文(29)

文章存档

2017年(1)

2012年(1)

2011年(5)

2010年(2)

2009年(20)

我的朋友
最近访客

分类:

2010-04-12 17:00:00

gridview中获取主键的值

GridView1_RowCommand中获取主键的值:

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

{

int OrderId = Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value); }

GridView1_PageIndexChanging中获取主键的值

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)

{

int index=GridView1.DataKeys[e.NewPageIndex].Value;

}

GridView1_RowDeleting中获取主键的值

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)

{

int index=GridView1.DataKeys[e.RowIndex].Value;

}

GridView1_RowEditing中获取主键的值

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)

{

int index = GridView1.DataKeys[e.NewEditIndex].Value;

}

GridView1_RowUpdating中获取主键的值

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)

{

int index = GridView1.DataKeys[e.RowIndex].Value;

}

GridView1_RowDataBound中获取主键的值

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

int index = GridView1.DataKeys[e.Row.RowIndex].Value;

}

阅读(981) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~