I'm having this trouble referencing the type of control that I
render. Here is the code that i use to either add a ListBox or a
DropDownList to a place holder...
if (EventType == "VERSUS"){
DropDownList ddlOpponent = new DropDownList();
OpponentPlaceHolder.Controls.Clear();
OpponentPlaceHolder.Controls.Add(ddlOpponent);
}else if (EventType == "MULTIPLE"){
ListBox ddlOpponent = new ListBox();
ddlOpponent.SelectionMode = ListSelectionMode.Multiple;
OpponentPlaceHolder.Controls.Clear();
OpponentPlaceHolder.Controls.Add(ddlOpponent);
}
How could I then reference this control ddlOpponent and pass it to a
function that takes a list or dropdown to a method, such as the
following?
Call: BindList(ddlOpponent);
Method: private void BindList(TextBox ddlOpponent){}