I tried to add a DropdownList to a panel, which I created in the aspx file. In the end, I would like to have a DropDownList, which will be only shown on one page.
This is how I created my panel:
<asp:Panel runat="server" ID="pnlChannel"></asp:Panel>
Then I create the DropdownList inside the codebehind :
The method gets called, but then theres always a error: Object reference not set to an instance of an object
public void createDropDownList()
{
int id = Convert.ToInt32(Request.QueryString["id"]);
if (id == 8)
{
DropDownList ddl = new DropDownList();
ddl.Items.Add(new ListItem("One", "1"));
ddl.Items.Add(new ListItem("Two", "2"));
ddl.Items.Add(new ListItem("Three", "3"));
d ...
Go to the complete details ...