c#引导程序在转发器中对ifal()使用if else

时间:2018-10-11 05:23:54

标签: c# twitter-bootstrap-3 repeater

<asp:Button ID="btnbl" runat="server" Text="Block" 
CommandArgument='<%#Eval("id")+","+ Eval("block")%>'  
CommandName="changebutton1" class="btn btn-primary btn-purple" />

如果eval(“ block”)== 1,是否有地方可以制作类,将类更改为class =“ btn btn-primary btn-purple disable”?

1 个答案:

答案 0 :(得分:0)

在这里像?:一样使用条件运算符class='<%# Convert.ToInt32(Eval("block")) == 1? "btn btn-primary btn-purple disabled" : "btn btn-primary btn-purple"%>'

Ex-

<asp:Button ID="btnbl" runat="server" Text="Block" 
CommandArgument='<%#Eval("id")+","+ Eval("block")%>'  
CommandName="changebutton1" class='<%# Convert.ToInt32(Eval("block")) == 1? "btn btn-primary btn-purple disabled" : "btn btn-primary btn-purple"%>' />

看看有帮助吗