我不们直接在Foreach 里面直接添加IF,这样会报错,这个前提是子视图,其他的我没有试验过。像这样:

@foreach (Gift.Modules.Model.Entitys.XT_CZ item in ViewData["ZTCZ"] as IList<Gift.Modules.Model.Entitys.XT_CZ>)
{
string htmlfaction = @item.Action + "()";
if (true)
{
@saveorcancel = true;
}
<a href="javascript:void(0)" id="@item.Action" onclick="@htmlfaction" class="easyui-linkbutton" data-options="iconCls:'@item.IconCls'" style="width: 80px; margin-right: 5px; margin: 5px;">
@item.CZMC
</a>
}

应该改成这样:

@foreach (Gift.Modules.Model.Entitys.XT_CZ item in ViewData["ZTCZ"] as IList<Gift.Modules.Model.Entitys.XT_CZ>)
{
string htmlfaction = @item.Action + "()";
<text>
@if (true)
{
saveorcancel = true;
}
</text>
<a href="javascript:void(0)" id="@item.Action" onclick="@htmlfaction" class="easyui-linkbutton" data-options="iconCls:'@item.IconCls'" style="width: 80px; margin-right: 5px; margin: 5px;">
@item.CZMC
</a>
}

这样就可以正常运行。

最新文章

  1. owner:轻松管理java项目配置
  2. 必杀技———SQL基础整理系列(一)
  3. ubuntu下安装lrzsz
  4. BZOJ 2463: [中山市选2009]谁能赢呢?
  5. 基于WWF搭建的通用审批流程
  6. [C]遍历目录下所有文件
  7. Linux QT
  8. 9-cat 简明笔记
  9. Storm-166:Nimbus HA solution based on Zookeeper
  10. js 字符串转 数字
  11. 在JavaScript 自定义对象来模拟Java中的Map
  12. get mac 20150202
  13. LSI SAS 2308配置操作
  14. POJ1363:Rails
  15. Warning: Cannot modify header information - headers already sent by (output started at
  16. Openjudge-计算概论(A)-简单算术表达式求值
  17. 【转】vue父子组件之间的通信
  18. nodejs koa2 框架中,mongoose update一条数据
  19. 2、JDBC-CURD
  20. Java学习——上转型与下转型对象

热门文章

  1. nginx 匹配路由分发php和golang
  2. 内存检测工具valgrind
  3. BZOJ1055[HAOI2008]玩具取名 【区间dp + 记忆化搜索】
  4. 洛谷 P3302 [SDOI2013]森林 解题报告
  5. 牛客~~wannafly挑战赛19~A 队列
  6. 优化web前端性能的几个方法
  7. Linux忘记Mysql原来root的密码
  8. 笔记软件:三强篇EverNote、Mybase、Surfulater
  9. UVa10891 Game of Sum
  10. RQNOJ 34 紧急援救