如题,我在REPEATER里绑定数句,要判断一个值做不同的事情 怎么写 ,我的语句肯定是错的
错误信息:The name 'Container' does not exist in the current context
错误信息:The name 'Container' does not exist in the current context
解决方案 »
- 用.NET编程序《基于.NET的软件远程共享和管理系统设计》
- 没办法,问题没解决还得发贴,谢谢了先,我的问题是“GridView导出Excel没有数据的区域为空白,是怎么回事啊,怎么解决,重谢”
- ispostback的理解问题
- #region 与#endregion之间的代码的作用
- datalist或者datagrid中如何显示多张图片
- 请教一个关于在服务器端执行程序的问题
- 呵呵!新手问两个问题(C#)
- 回车键的老问题???
- 两Access数据库,如何查询数据
- 我将源代码粘贴到WEB Matrix中发现代码出现部分乱码为什么?
- asp.net C# 怎么删除硬盘上的文件阿?
- “/bbs”应用程序中的服务器错误。有经验的进来帮忙~~50分###################
由于当时用的是REPEATER控件,没有办法直接处理CELL的属性
所以我不得不把原来的直接输出
<%# DataBinder.Eval(Container.DataItem,"score") %>
修改为
<asp:Label ID="score" Runat="server"><%# DataBinder.Eval(Container.DataItem,"score1") %></asp:Label>
然后加上REPEATER控件ItemDataBound方法的代码
if (e.Item.ItemType==ListItemType.Item){
if(Convert.ToInt16(DataBinder.Eval(e.Item.DataItem, "score1"))<60)((Label)e.Item.FindControl("score1")).ForeColor=Color.Red;
}
<%#Panduan((string)DataBinder.Eval(Container.DataItem,"qabz"))%>cs文件
protected string Panduan(string str)
{
if(str=="Q")
return "";
else
return str;
}
<%if(DataBinder.Eval(Container.DataItem,"qabz").ToString()=="Q")
{
%>
表格一
<%
}
else
{
%>表格二(复杂表格,不同与表格一)
<%
}
%>
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<%if(DataBinder.Eval(Container.DataItem,"qabz").ToString()=="Q")%>
<%
{
%>
<tr>
<th colspan="2">主题:<%#DataBinder.Eval(Container.DataItem,"ZT")%></th>
</tr>
<tr bgcolor="#FFFFFF">
<td width="431">股票基金分红的红利如何使其自动转为现金增值基金?</td>
<td width="142"><%#((string)DataBinder.Eval(Container.DataItem,"zt")).Replace("\n","<br>").Replace(" "," ")%></td>
</tr>
<%
}
else
{
%>
<tr bgcolor="#f5f5f5">
<td bgcolor="#f5f5f5">答:测试测试</td>
<td width="142"> </td>
</tr>
<%
}
%>
</ItemTemplate>
</asp:Repeater>
</table>