行 LinkBut​​ton 声明中的编译器错误消息

发布于 2024-12-29 14:10:20 字数 282 浏览 2 评论 0原文

我有以下 ASP 代码:

<asp:LinkButton ID="LinkButton1" runat="server" Text="edit item" onclick='AddItem.aspx?catid=<%# Eval("CollectionID")%>' />

在这一行中,我收到错误编译:

编译器错误消息:CS1040:预处理器指令必须显示为行上的第一个非空白字符

为什么会收到此错误以及如何修复它? 先感谢您!

I have the following ASP code:

<asp:LinkButton ID="LinkButton1" runat="server" Text="edit item" onclick='AddItem.aspx?catid=<%# Eval("CollectionID")%>' />

In this row i get Error compilation:

Compiler Error Message: CS1040: Preprocessor directives must appear as the first non-whitespace character on a line

Why do I get this error and how can i fix it?
Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

○愚か者の日 2025-01-05 14:10:20

你可以用这种方式来做。

<asp:LinkButton ID="LinkButton1" runat="server" Text="edit item" 
PostBackUrl='AddItem.aspx?catid=<%# Eval("CollectionID")%>' />

You can do it in this way.

<asp:LinkButton ID="LinkButton1" runat="server" Text="edit item" 
PostBackUrl='AddItem.aspx?catid=<%# Eval("CollectionID")%>' />
金橙橙 2025-01-05 14:10:20

您确定这条是导致问题的线路吗?一般来说,当您看到此错误时,这是​​因为您的 <@ > 有问题。代码顶部的页面指令。确保您的<@Page>指令是文件中的第一件事,并且格式正确,并且除了页面指令之外,代码中没有任何其他 <@ 符号。

Are you certain that this is the line causing the problem? Generally when you see this error it is because there is a problem with your <@ > page directives at the top of the code. Make sure your <@Page> directive is the very first thing in the file and that it's formatted correctly and that you don't have any other <@ symbols in your code aside from your page directives.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文