gridview中单击那个选择按钮取到那行的ID值?

2024-10-31 23:25:27
有1个网友回答
网友(1):

添加GridView的SelectedIndexChanging事件处理函数
void GridView1_SelectedIndexChanging(Object sender, GridViewSelectEventArgs e)
{
GridViewRow row = CustomersGridView.Rows[e.NewSelectedIndex];
string strUserId=row.Cells[1].Text;
string strUserName=row.Cells[2].Text;
string strUserPassword=row.Cells[3].Text;
}