gpt4 book ai didi

c# - 服务器标签格式不正确?

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

在向段落添加样式之前,它工作正常,但如果我添加样式,我会收到服务器标签格式不正确等错误。请检查我的代码

<p 
title='<%# DataBinder.Eval(Container.DataItem, "Title") %>'
id="P1"
runat="server"
style="top:<%# DataBinder.Eval(Container.DataItem, "Tops") %>px; left:<%#DataBinder.Eval(Container.DataItem, "Lefts") %>px; font-size:15px; color:White;">
</p>

最佳答案

在服务器绑定(bind)控件上,如果您想在属性内使用 <%#whatever%>,它们必须使用单引号而不是双引号。即:

<asp:Label id="lbl1" runat="server" Text='<%#Eval("myvalue")%>' />

<p id="p1" runat="server" style='background:<%#Eval("color")%>;'>stuff here</p>

关于c# - 服务器标签格式不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11864247/

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