gpt4 book ai didi

c# - 如何在 PreInit 期间访问 ASP.NET 页面控件?

转载 作者:太空宇宙 更新时间:2023-11-03 11:05:24 24 4
gpt4 key购买 nike

最近我使用了一个类,解释为 here在 PreInit 期间访问动态控件。该帖子的标题为“在 PreInit 期间访问 ASP.NET 页面控件”,在本地它运行完美,但在服务器上我收到以下错误:

Compiler Error Message: CS1031: Type expected

Source Error:

Line 12: /// in turn makes our controls accessible so that we can make the calls below.
Line 13: /// </remarks>
Line 14: public static void PrepareChildControlsDuringPreInit(this Page page)
Line 15: {
Line 16: // Walk up the master page chain and tickle the getter on each one

如果有人就此问题给我解决方案或建议,我将不胜感激。

最佳答案

听起来,在本地,您正在运行比服务器更新的 .NET Framework 版本。

我相信只有 .NET 3.5 及更高版本才支持扩展方法(使用您使用的语法)。因此,如果您运行的 .NET Framework 版本低于您服务器上的版本,我认为这会导致您遇到编译器错误(当它尝试在服务器上编译时)。

关于c# - 如何在 PreInit 期间访问 ASP.NET 页面控件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16040997/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com