Repeater的数据源中有一列是bool型,我想它在False的时候输出一个否,跟一个LinkButton,True的时候就输出一个"是",本来想用if来做的,可是<%# %>中不支持if语句。请问这种效果如何实现?

解决方案 »

  1.   

    <%# DataBinder.Eval(Container.DataItem,"IsValid)?"是":"否"%>
      

  2.   

    对,这样是跟否是有了,但有否的同时还得有一个LinkButton啊!
      

  3.   

    我跟着你的问题问下
    但是如果我列中存的不是boolen值呢?
    比如  是  yes  或者 no  这样怎么来用一个语句写进去
      

  4.   

    xifan930 如果是用的yes跟no的话,可以用<%# (DataBinder.Eval(Container.DataItem,"DataColumn")).ToString() == "yes"?"是":"否" %>
      

  5.   

    TO maytenth(傲客不拽) 
    对,这样是跟否是有了,但有否的同时还得有一个LinkButton啊!
    这个时候你写个函数应该是比较好的。

    Function  GetLinkBtn (Byval str as Boolen)
    if not str then
    ///不送出连接
    else
    ///送出连接end if
    End Function
      

  6.   

    那前台如何调用呢?我全是用DW写的asp.net,cs文件用它的编译工具打包成dll