62,056
社区成员
发帖
与我相关
我的任务
分享
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList drop = sender as DropDownList;
GridViewRow row = drop.Parent.Parent as GridViewRow;
int id;
int.TryParse(row.Cells[0].Text, out id);//直接
//int id = GridView1.DataKeys[row.RowIndex].Value.ToString();
//如果设置了GridView的主键为id的话,用这句取id
}