简体   繁体   English

错误:服务器标记格式不正确

[英]Error : The server tag is not well formed

<asp:Image ID="imgteacher" runat="server" Height="150" Width="248" ImageUrl="ShowImage.ashx?id="+<%#Eval("CourseID") %>/>

Please, correct my writing mistake . 请纠正我的写作错误。 I think my problem is because of only this row, therefore I only copied this row. 我认为我的问题是因为只有这一行,因此我只复制了这一行。

Parser Error Message: The server tag is not well formed.

The reason for the error message is the data binding in the ImageUrl attribute. 错误消息的原因是ImageUrl属性中的数据绑定。 In order to make this work you need to exchange the double quotes by single ones and adjust the data binding code: 为了完成这项工作,您需要通过单引号交换双引号并调整数据绑定代码:

<asp:Image ID="imgteacher" runat="server" Height="150" Width="248" 
    ImageUrl='<%# "ShowImage.ashx?id="+ DataBinder.Eval(Container.DataItem, "CourseID") %>'/>

Try This 试试这个

Simple wadata binding in the ImageUrl attribute ImageUrl属性中的简单wadata绑定

<asp:Image ID="imgteacher" runat="client" Height="150" Width="248" ImageUrl="ShowImage.ashx?id="+<%#Eval("CourseID") %>/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM