Ivar
Ivar

Reputation: 6818

The name 'someControl' does not exist in the current context

I have some weird problem with asp.net controls.

I am editing a (previously) working page, but when I add a new control, and try to run it, it says:

The name 'xxx' does not exist in the current context

Also when I rename a working control, on both markup, and code-behind file, it will also give this error for this control.

I did read something about deleting the designer file, and "convert to web application", but I don't have any designer file, nor the option to "convert to web application.".

Does anyone have any suggestions?

Edit: Some example:

Markup:

<asp:DropDownList runat="server" ID="ddlBank" style="width: 227px;">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="DropDownList1" style="width: 227px;">
</asp:DropDownList>

Code behind:

if (ddlBank.SelectedValue == "0")
{
    displayMessageBar("Error", "Je dient eerst een bank op te geven.", "error");
    return;
}

if (DropDownList1.SelectedValue == "0")
{
    displayMessageBar("Error", "Je dient eerst een bank op te geven.", "error");
    return;
}

The error message my IDE gives:

Error message

Upvotes: 1

Views: 1084

Answers (1)

Ivar
Ivar

Reputation: 6818

Found the solution:

It seems that some colleague added another page, pointing to the same code-behind file. That worked fine, until I changed something.

Let's hope someone else can use this information.

Upvotes: 1

Related Questions