A
Author
I am curious about this. Is it possible to bind the Enabled property
to a method in my code behind?
So, suppose I have this method in code-behind (a code skeleton only,
not real code)
protected bool IsCancelOrderButtonEnabled()
{
bool isEnabled = true;
DataTable customerOrder = GetCustomerOrder();
if (customerOrder.Rows[0]["ShipStatus"].ToString().ToLower().Equals
("true"))
{
isEnabled = false;
}
return isEnabled;
}
Now, in the markup, can I do the following?
<asp:Button ID="btnCancelOrder" runat="server" Text="Cancel Order"
Enabled='<%# IsCancelOrderButtonEnabled() %>' />
I tried, it didn't work.
to a method in my code behind?
So, suppose I have this method in code-behind (a code skeleton only,
not real code)
protected bool IsCancelOrderButtonEnabled()
{
bool isEnabled = true;
DataTable customerOrder = GetCustomerOrder();
if (customerOrder.Rows[0]["ShipStatus"].ToString().ToLower().Equals
("true"))
{
isEnabled = false;
}
return isEnabled;
}
Now, in the markup, can I do the following?
<asp:Button ID="btnCancelOrder" runat="server" Text="Cancel Order"
Enabled='<%# IsCancelOrderButtonEnabled() %>' />
I tried, it didn't work.