翼度科技»论坛 编程开发 .net 查看内容

c#使用tp

4

主题

4

帖子

12

积分

新手上路

Rank: 1

积分
12
一说tp大多数人想到的是PHP使用tp,但今天不说PHP <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>说说c#使用tp  <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>由于tp比较久远 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>网上的资料又是少之又少 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>接下来说说tp的一些基本用法
1.首先就是数据绑定了
  1. <%tp:foreach <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>collection="{$model.Items}" <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>var="m"%>
  2. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><td>{$m.name}</td>
  3. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><td>{$m.phone}</td>
  4. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>........
  5. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><%/tp:foreach%>
复制代码
发现没 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>是不是有点类似Angular <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>关键点就是在于要加 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>结尾
 
2.条件判断
  1. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><%tp:if <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>test="{$isempty(m.status)}"%>//非空判断
  2. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>type="button">审核</button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>>
  3. <%tp:elseif <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>test="{$eq(m.State,"已提交")}"%>//是否等于某值
  4. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>type="button">审核</button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>>
  5. <%tp:else%>//剩下的就是其他状态了
  6. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>type="button">提交</button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>>
  7. <%/tp:if%>
复制代码
其中也不含也包含多条件
  1. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>
复制代码
3.赋值
  1. 共{$(model.Items.title)}
复制代码
这个就类似于咱们webform中直接取model中的值赋值了 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>但是前提是后台你的将model对象写进去
  1. <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>_template.SetValue("model", <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>result);//model <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>就是前台页面的赋值名字 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>result就是你获取是数据对象结果
复制代码
剩下的待续........ 
 

来源:https://www.cnblogs.com/wuyabaibsd/archive/2023/09/07/17685675.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>我们会及时删除侵权内容,谢谢合作!

举报 回复 使用道具