2012-04-11 45 views

回答

2

試試這個:背後

<asp:Button ID="Button1" runat="server" Text="Button" Visible='<%#getVisibility()%>' OnClick="btn_Click" /> 

代碼:

public Boolean getVisibility() 
{ 
    Boolean b = false; 
    //get the boolean value based on your field condition 
    b = Convert.ToBoolean(Eval("FieldValue").ToString() != "MatchCondition" ? "true" :  "false"); 
    return b; 
} 
2

要麼是在數據綁定事件或做這樣的......

<asp:Button ID ="btn" runat ="server" Visible='<%# Eval("id").ToString() == "1"? "false" : "true" %>' /> 
相關問題