Hello,

I seem to have a lack of understanding here and need some help.

When I try and compile this in MS Visual Web Developer 2010 I am getting this error

Error 5 The name 'DropDown1' does not exist in the current context

I do not understand why this happening.

Could someone please explain why this would be happening.


Thanks
Mike


if (!LabelIsDone)
{
DropDownListText = "";
LabelIsDone = true;
CtrlNbr++;
DropDownListId = "List1" ;
DropDownList DropDown1 = new DropDownList();
DropDown1.ID = DropDownListId; DropDown1.Width = 255;
DropDown1.Items.Add("TEST ENTRY");
this.PlaceHolder1.Controls.Add(DropDown1);
else
{
DropDown1.Items.Add("ENTRY 2);
}