0

I have a web application that I have been developing for some time. Yesterday when I loaded the project into VS the aspx files could no longer see the aspx.vb files. I reverted to the backup I had just made and everything was fine. Today, the same problem.

Example:

FILE: QuerySql.aspx

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master"
    CodeBehind="QuerySql.aspx.vb" Inherits="WhatIsPouring_Ajax.QuerySql" %>

FILE: QuerySql.aspx.vb

Public Class QuerySql Inherits DBFunctions

Overloads Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Not IsPostBack Then
        tbPassword.Text = sPassword
        tbUser.Text = sUserName
        tbServer.Text = sDBServer
    End If
    tbError.Text = "The system is loaded."
End Sub

There is a public variable sDBServer in the code behind file. The .vb file sees all the controls on the aspx side. If I type <%=sDBServer %> it displays an error "sDBServer is not declared..."

I believe it has something to do with the project configuration somewhere, but I don't know where to go the fix it. I have cleaned, built, rebuilt, etc many times.

Any help is appreciated.

Marco
  • 18,261
  • 5
  • 58
  • 93

1 Answers1

0

Your code behind is missing the Partial keyword, e.g.

Partial Class QuerySql Inherits DBFunctions

Make sure that the designer generated class also has the same keyword to bind the ASPX file to your class.

If the designer file is missing you can regenerate it by right-clicking the ASPX page and selecting "Convert to Web Application"

How do you force Visual Studio to regenerate the .designer files for aspx/ascx files?

Community
  • 1
  • 1
codemonkeh
  • 1,811
  • 1
  • 18
  • 31