Tuesday, October 19, 2010

To get Grid Selected RowIndex and Template Controls in DropDownList SelectedIndex Event

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = ((DropDownList)sender).Parent.Parent as GridViewRow;

int gvrO = Convert.ToInt32(row.RowIndex);

DropDownList ddltest = new DropDownList();
ddltest = (DropDownList)row.FindControl("ddlTest");
string ss = ddltest.SelectedItem.Text;
}

No comments: