CS 파일을 ASCX/ASPX 페이지에 추가하고 바인딩하는 방법은 Alrady가없는 페이지를 가지고 있지 않습니까?

StackOverflow https://stackoverflow.com/questions/1406608

  •  05-07-2019
  •  | 
  •  

문제

나는 어리석은 질문을 알고 있지만 운이없는 Google에서 찾아 보려고 노력했습니다.

도움이 되었습니까?

해결책

Add an Inherits attribute to your <@Page directive with the name of the class represented in the cs file. For example:

<@Page ... Inherits="MyNamespace.MyCustomPage">

다른 팁

As Jason has already answered, also put a "CodeFile=anycodefile.cs" in the page directive.
<@Page ... Inherits="MyNamespace.MyCustomPage" CodeFile="MyCustomPage.cs">

If your page has a code-behind file, use the CodeFile attribute. Otherwise put the assembly containing the code behind class in the bin folder and use the inherits. The class must derive from webpage or usercontrol and must be public.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top