如何在另一个用户控件中使用 ASP.NET 用户控件?

发布于 2024-07-07 09:49:51 字数 261 浏览 9 评论 0原文

我有一个用户控件 (gallery.ascx),我想在图库控件中使用 photo.ascx 控件。 我已在 gallery.ascx 的顶部添加了此寄存器,但它仍然找不到照片:

<%@ Register TagPrefix="ssctrl" TagName="photo" Src="controls/photo.ascx" %>

有什么想法吗?

I have a user control (gallery.ascx) and I want to use the photo.ascx control in the gallery control. I've added this register at the top of gallery.ascx, but it still can't find photo:

<%@ Register TagPrefix="ssctrl" TagName="photo" Src="controls/photo.ascx" %>

Any ideas?

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

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

发布评论

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

评论(1

々眼睛长脚气 2024-07-14 09:49:51

如果有人想知道,注册是正确的,我的照片用户控制标签只是没有正确形成。 我确实将其设置为:

<ssctrl:photo ID="Photo" Key="<%# Eval("PageTemplatePK") %>" runat="server" />

并且 Key 属性需要使用单引号而不是双引号,因为它使用 Eval 表达式:

<ssctrl:photo ID="Photo" Key='<%# Eval("PageTemplatePK") %>' runat="server" />

之后,它起作用了。

In case anyone is wondering, the Register is correct, my photo user control tag was just not formed properly. I did have it as:

<ssctrl:photo ID="Photo" Key="<%# Eval("PageTemplatePK") %>" runat="server" />

and the Key property needed to use single quotes instead of double quotes because it was using an Eval expression:

<ssctrl:photo ID="Photo" Key='<%# Eval("PageTemplatePK") %>' runat="server" />

After that, it worked.

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