我创建一控件时候,用到datalist ID= "Mylist "
源代码如下:
<asp:DataList ID= "Mylist " runat= "server " width= "500 " CellPadding= "0 " CellSpacing= "0 ">
<ItemTemplate>
<asp:Label class= "NormaBold " Text= ' <%# DataBinder.Eval(Container.DataItem, "CustomerName ") %> 'runat= "server " ID= "Label1 " />
<span class= "Normal "> 评论如下。。。。 </span>
<img src= 'images/ReviewRating <%# DataBinder.Eval(Container.DataItem, "Rating ") %> .gif ' >
<br>
<asp:Label class= "Normal " Text= ' <%# DataBinder.Eval(Container.DataItem, "Comments ") %> 'runat= "server " ID= "Label2 " />
</ItemTemplate>
</asp:DataList>
当我切换到设计里时候就出现错误说:创建控件是出错,Mylist服务器标记格式不正确
------解决方案--------------------------------------------------------
<asp:DataList ID= "Mylist " runat= "server " width= "500 " CellPadding= "0 " CellSpacing= "0 "> <ItemTemplate> <asp:Label class= "NormaBold " Text= ' <%# DataBinder.Eval(Container.DataItem, "CustomerName ") %> ' runat= "server " ID= "Label1 " /> <span class= "Normal "> 评论如下。。。。 </span> <img src= 'images/ReviewRating <%# DataBinder.Eval(Container.DataItem, "Rating ") %> .gif ' > <br> <asp:Label class= "Normal " Text= ' <%# DataBinder.Eval(Container.DataItem, "Comments ") %> ' runat= "server " ID= "Label2 " /> </ItemTemplate> </asp:DataList>