0

The codebehind is acting like it doesn't see the aspx page.

This is the code behind:

protected void Page_Load(object sender, EventArgs e)
    {
        DashResultsViewModel dashResultsList = new DashResultsViewModel();

        ListView1.DataSource = dashResultsList.Display();

        ListView1.DataBind();
    }

This is the aspx page where it creates ListView1

<asp:ListView ID="ListView1" runat="server">
        <ItemTemplate>
            <asp:Label ID="Label1" Text="<%#Container.DataItem %>" runat="server" />
        </ItemTemplate>
    </asp:ListView>

The error: "The name 'ListView1' does not exist in the current context"

Question: How do I get it to work?

  • possible duplicate of [The name 'controlname' does not exist in the current context](http://stackoverflow.com/questions/706603/the-name-controlname-does-not-exist-in-the-current-context) – Kritner Jul 01 '15 at 13:18

1 Answers1

0

The connection between .aspx and .cs is somehow broken. Try deleting .designer.cs file and regenerating it by right clicking on relating .aspx and selecting Convert to Web Application from popup-menu. Good Luck

Jamil
  • 330
  • 1
  • 6
  • 25