当前位置:编程学习 > C#/ASP.NET >>

“System.Web.UI.WebControls.Image”不具有名为“td”的公共属性

<table  style="width: 204px; height:448px; font-size: 9pt; font-family: 宋体; vertical-align :top ; background-image: url(../images/index_16.gif);  background-repeat :no-repeat"  border="0" cellpadding="0" cellspacing="0" >
<tr>
<td style="height: 39px">
</td>
</tr>
    <tr align ="center" style="width: 204px;  font-size: 9pt; font-family: 宋体; vertical-align :top ;">
        <td style="height: 304px">
         <asp:DataList ID="dlClass" runat="server"  OnItemCommand="dlClass_ItemCommand">
                <ItemTemplate>
                    <table >
                        <tr>
                        <td align ="left"  style ="width :28px; height :25px;vertical-align :bottom">
                        <asp:Image ID="imageIcon" runat="server"  ImageUrl ="<%#DataBinder.Eval(Container.DataItem,"CategoryUrl")%>" />
                        </td>
                      <td> </td>
                            <td align ="left" style ="width :80px;  height :25px; font-size: 9pt; font-family: 宋体; vertical-align :bottom " > 
                            <asp:LinkButton ID="lnkbtnClass" runat="server" CommandName="select" CausesValidation="False"  CommandArgument =<%#DataBinder.Eval(Container.DataItem,"ClassID") %>><%# DataBinder.Eval(Container.DataItem, "ClassName") %></asp:LinkButton>
                            </td>
                        </tr>
                        
                    </table> 
                </ItemTemplate>
            </asp:DataList>
            </td>
    </tr>
    </table>
    <table  style="width: 204px; height: 181px; font-size: 9pt; font-family: 宋体; vertical-align :top ;  text-align :center; background-image: url(../images/新品上市.jpg); background-repeat :no-repeat"  border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td style="height: 11px; width: 204px;"></td>
    </tr>
     <tr>
        <td  style="width: 204px; height: 169px;">
         <marquee direction="up" onmouseout="this.start()" onmouseover="this.stop()" scrollamount="2" scrolldelay="4" style="width: 130px;height: 128px; font-size: 9pt; font-family: 宋体; vertical-align :top ;  text-align :center; " >本电子商城欢迎您的光临!我们将为您展示各种最新商品,让您的生活更加丰富,购物更加愉快!如果你有什么所需要的,请给本网站留言!</marquee>
        </td>
    </tr>
    
</table>

出现“System.Web.UI.WebControls.Image”不具有名为“td”的公共属性的错误。怎么回事??请各位大神帮忙。 --------------------编程问答-------------------- <ItemTemplate>里面直接放你绑定的东西就行,不用加个Table --------------------编程问答-------------------- ImageUrl ="<%#DataBinder.Eval(Container.DataItem,'CategoryUrl')%>" />


改成单引号 试试 --------------------编程问答-------------------- ImageUrl =‘<%#DataBinder.Eval(Container.DataItem,“CategoryUrl”)%>’ />


或者外面单引号  里面用双引号  试下 --------------------编程问答-------------------- 可是我需要样式的啊,具体该怎么改,谢谢帮助!! --------------------编程问答--------------------
引用 4 楼 LiJingTangh 的回复:
可是我需要样式的啊,具体该怎么改,谢谢帮助!!


楼主 我让你修改的是 <asp:Image ID="imageIcon" runat="server"  ImageUrl ="<%#DataBinder.Eval(Container.DataItem,"CategoryUrl")%>" />

跟样式没关系。
改成 <asp:Image ID="imageIcon" runat="server"  ImageUrl =‘<%#DataBinder.Eval(Container.DataItem,"CategoryUrl")%>’ />  试试 --------------------编程问答--------------------
引用 4 楼 LiJingTangh 的回复:
可是我需要样式的啊,具体该怎么改,谢谢帮助!!

用div套你的控件 --------------------编程问答--------------------
引用 3 楼 still_melody 的回复:
ImageUrl =‘<%#DataBinder.Eval(Container.DataItem,“CategoryUrl”)%>’ />


或者外面单引号  里面用双引号  试下


问题解决了,谢谢各位!!
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,