Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# &引用;服务器标记的格式不正确。”;什么';怎么了?_C#_Asp.net - Fatal编程技术网

C# &引用;服务器标记的格式不正确。”;什么';怎么了?

C# &引用;服务器标记的格式不正确。”;什么';怎么了?,c#,asp.net,C#,Asp.net,我得到以下解析器错误消息。我如何解决这个问题 服务器标记的格式不正确 代码: 首先,您的定位点是客户端,您应该在此添加runat=“server”属性。第二,试着像下面这样使用它 <a href="#" runat="server" id="mySprite1" class='<%# "mySprite id" + ((int)DataBinder.Eval(Container,"ItemIndex")) % 6 + 1 %>'> 查看表达式中的差异可能会有所帮助:

我得到以下解析器错误消息。我如何解决这个问题

服务器标记的格式不正确

代码:


首先,您的定位点是客户端,您应该在此添加
runat=“server”
属性。第二,试着像下面这样使用它

<a href="#" runat="server" id="mySprite1" 
class='<%# "mySprite id" + ((int)DataBinder.Eval(Container,"ItemIndex")) % 6 + 1 %>'>

查看表达式中的差异可能会有所帮助:

只有数据绑定才需要
runat=“server”


因此,请改用
语法。还要确保您的引号没有混淆,所以使用
作为外部引号,使用
作为内部引号。

我需要给出单引号还是什么?只要您不在数据绑定事件(或标签的associatedControl属性)上使用html控件,您就不需要
runat=“server”
!@Andreas::是的,我知道..thnx…@Zain::缺少单引号..现在解决了..thnx
<a href="#" runat="server" id="mySprite1" 
class='<%# "mySprite id" + ((int)DataBinder.Eval(Container,"ItemIndex")) % 6 + 1 %>'>