GridView / RowCommand / e.CommandArgument

GridView / RowCommand / e.CommandArgument

 

In the following GridView’s RowCommand method,

public void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

 

e.CommandArgument is automatically set to the row index (as a string, not as an int). So if the GridView ID is GridView1, here's an easier solution to get the current RowIndex:

int index = Convert.ToInt32(e.CommandArgument);

GridViewRow row = GridView1.Rows[Convert.ToInt32 (e.CommandArgument)];

 

 

posted @ 2006-11-17 09:40  Rickie  阅读(2083)  评论(1编辑  收藏  举报