开发者

Visual Studio creation of WebForms vs Blank Files

开发者 https://www.devze.com 2023-02-27 08:17 出处:网络
When trying to write the codebehind file for its associates aspx page a colleague and I were stumped as to why the Controls within file.aspx were not appearing in the codecompletion, nor were they com

When trying to write the codebehind file for its associates aspx page a colleague and I were stumped as to why the Controls within file.aspx were not appearing in the codecompletion, nor were they compiling without error.

When i created the file.aspx and file.aspx.cs I had created these items as blank files, the file.aspx.cs build action was set to Compile while the file.aspx Build Action was Content.

We created a new "webform" item that automatically generated the SecondFile.aspx and the SecondFile.asp开发者_开发问答x.cs file and associated them. We copied the HTML and code from file to SecondFile and the code completion worked, and the codeBehind compiled correctly.

Why?


You have not included enough information, but I think you might have forgot to put the page declaration at the top of your .aspx file

<%@ Page Language="C#" CodeFile="file.aspx.cs" Inherits="my_ascx_class_name" %>
0

精彩评论

暂无评论...
验证码 换一张
取 消