Reputation: 30303
In web application, I am going to disable the button while binding data, is it possible visibling false like this?
<asp:Button ID ="btn" runat ="server" CommandArgument='<%# Eval("id").ToString() == "1"? visble false: Visible true %>' />
Upvotes: 1
Views: 1528
Reputation: 7525
Try this:
<asp:Button ID="Button1" runat="server" Text="Button" Visible='<%#getVisibility()%>' OnClick="btn_Click" />
Code Behind:
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;
}
Upvotes: 2
Reputation: 2901
Either do that in the data bound event or do it like this...
<asp:Button ID ="btn" runat ="server" Visible='<%# Eval("id").ToString() == "1"? "false" : "true" %>' />
Upvotes: 2