Code added to CodeBehind not executing

孤街醉人 提交于 2019-12-02 03:51:43

Any code added to a .cs file outside of /App_Code/ must be compiled before it "counts" - that part should be dealt with when you build the project.

Also, the master page must reference its code behind for it to pick it up, like

<%@ Master Language="C#"
    AutoEventWireup="true" CodeBehind="MyMasterpage.master.cs" Inherits="MyNamespace.MyMasterpage" %>

Can you perhaps also share the master page content?

The reason this was not functioning correctly is because the previous developers had compiled their code but had also uploaded the C# files to the server. So the files we received were compiled.

After much political wrangling we got them to send us the uncompiled files which allowed me to make the code changes as expected.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!