I've added Dropdownlist in Gridview at RowDataBound event. The code is:
if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList ddlSeason = new DropDownList();
ddlSeason.DataSourceID = "odsRoomSeason"; ddlSeason.DataTextField = "SeasonTittle"; ddlSeason.DataValueField = "SeasonID"; ddlSeason.AutoPostBack = true; ddlSeason.SelectedIndexChanged += new EventHandler(ddlSeason_SelectedIndexChanged);
TableCell tcSeason= new TableCell();
tcSeason.Controls.Add(ddlSeason); e.Row.Cells.AddAt(e.Row.Cells.Count, tcSeason); }
The event handler I've added is: protected void ddlSeason_SelectedIndexChanged(object sender, EventArgs e) { // }
But the problem is that the event handler function doesn't catch the event. Please tell me how to write the correct event handler, also I need to get the row from which the Dropdownlist's event has fired.