I am facing an issue with the dynamic controls in my ASP.NET page.
For example, I have created a TextBox dynamically with the following code:
TextBox ratingtxtbox = new TextBox();
ratingtxtbox.ID = "Rating_1";
And also a DropDownList like this:
DropDownList Exsecondpositiontxtbox = new DropDownList();
Exsecondpositiontxtbox.ID = "Exacta2nd_" + i.ToString();
I have added a keyup event for the textbox using this code:
ratingtxtbox.Attributes.Add("onkeyup", "ChangebyWin(" + i.ToString()+")");
This works perfectly. However, when I tried to add an indexchanged event for the dropdown list using this code:
Exsecondpositiontxtbox.Attributes.Add("onselectedindexchanged", "ChangebyExacta(" + i.ToString() + ")");
It doesn't work. Do you think it could be due to an error in the key name?