我想將網站項目轉換爲Web應用程序,並且遇到一些問題,其中.aspx.cs文件可以「 t看到.aspx中的任何控件。我試過刪除.designer.cs文件並再次轉換爲Web應用程序,但這並未解決我的問題。如果我將.designer.cs文件的命名空間更改爲'SoftwareCheckout'(與我的.aspx.cs相同的命名空間),則.aspx.cs可以看到.aspx中的控件,但自.designer.cs是自動生成的,一旦它被重新生成,我將不會對它做任何更改。這導致我相信這是我的命名空間的問題,但我不是100%確定的。Web站點到Web應用程序:aspx.cs無法在.aspx中看到控件
這裏是我的.aspx的頂線稱爲StuCheckout.aspx:
<%@ Page Language="C#" AutoEventWireup="True" Inherits="StuCheckout" Codebehind="StuCheckout.aspx.cs" %>
這裏的第一對夫婦我.aspx.cs叫StuCheckout.aspx.cs(lblUser和lblTime線不能例如訪問)
namespace SoftwareCheckout
{
public partial class StuCheckout : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lblUser.Text = CurrentUser.getUsername();
lblTime.Text = CurrentUser.getDate();
setLocalRestrictions();
if (!(lblErrorText.Text == String.Empty))
lblErrorText.Visible = true;
我了.Designer.cs看起來是這樣的:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class StuCheckout {
/// <summary>
/// Head1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
有沒有人埃爾斯e遇到這個問題?我在這裏用盡想法,任何幫助都非常感謝!