How to Get DropDown value From GridView by clicking EDIT button and drop Down Value Shold be selected
-
Hi, This is from CHandrakanth. I have one gridview in that EDIT button is there. When i click on Edit Button the columnValue(ApplicationName - value) should be displayed in the DropdownList and that should be selected. the code and all i giving here protected void gdvRoleDetails_RowCommand(object sender, GridViewCommandEventArgs e) { ddlApplications1.SelectedIndex = 0; GridViewRow row = (GridViewRow)gdvRoleDetails.Rows[Convert.ToInt32(e.CommandArgument)]; if (e.CommandName == "Edit") { ListItem item = new ListItem(); item.Text = row.Cells[2].Text; ddlApplications1.Items.Clear(); hdnRoleId.Value = row.Cells[0].Text; txtRoleName.Text = row.Cells[1].Text; hdnAppl.Value = row.Cells[3].Text; ddlApplications1.SelectedIndex = ddlApplications1.Items.IndexOf(ddlApplications1.Items.FindByText(row.Cells[2].Text )); } } can any one suggest me what to follow for that
Chandrakanth