日期:2014-05-17  浏览次数:20467 次

“System.Web.UI.Control”并不包含对“DataItem”的定义
..写的自定义控件
HTML code

<%@ Control Language="c#" AutoEventWireup="false" Codebehind="myLeft.ascx.cs" Inherits="newVod.myLeft" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form runat="server"> 
<table width="200" border="0" cellpadding="0" cellspacing="0">
    <asp:Repeater ID="rpMenu" Runat="server">
        <ItemTemplate>
            <tr>
                <td valign="top" class="link1">
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
    <tr>
        <td height="28"><img src="images/wall-papge_06.jpg " width="200" height="250"> <a href="<%=strUrl %><%# DataBinder.Eval(Container.DataItem,"id")%>"><font color="#333333"><strong><%# DataBinder.Eval(Container.DataItem,"strField")%></strong></font></a></td>
    </tr>
</table>
</form>


在某个页面点用的时候出现错了。。
“System.Web.UI.Control”并不包含对“DataItem”的定义
怎么办...各位帮忙//

------解决方案--------------------
C# code
<td height="28"><img src="images/wall-papge_06.jpg " width="200" height="250"> <a href="<%=strUrl %><%# DataBinder.Eval(Container.DataItem,"id")%>"><font color="#333333"><strong><%# DataBinder.Eval(Container.DataItem,"strField")%></strong></font></a></td>

------解决方案--------------------
直接赋给一个变量就行了
------解决方案--------------------
绑定写错了吧