Reputation: 4003
I've found topics covering disabling buttons to avoid submitting twice (assuming this could be done via javascript), but what i need is to disable button of submit if field "formSubmitted" in the database holds true value. otherwise this means the form has not been submitted and this submit is required. Any idea how to do this?
<asp:TableCell>
<asp:Button id="acceptButton" Text="Accept" runat="server" OnClick="Click"/>
<asp:Button id="declineButton" Text="Decline" runat="server" OnClick="DeclineRequest"/>
</asp:TableCell></asp:TableRow></asp:Table></form></asp:Content>
so yeh the accept and decline buttons are what i want to disable if formsubmiited variable holds true. Thanks again,
Upvotes: 1
Views: 3245
Reputation: 765
if(acceptButton.Enabled.Equals(true))
{
acceptButton.Enabled = false;
}
Upvotes: 0
Reputation: 46047
Try something like this:
declineButton.Enabled = booleanVariable == false;
Or
declineButton.Enabled = !booleanVariable;
Upvotes: 1
Reputation: 3231
if (formSubmitted)
{
acceptButton.Enabled = false;
declineButton.Enabled = false;
}
Upvotes: 2
Reputation: 7797
Use the Enabled property.
if( WhateverYouAreTesting == true )
{
declineButton.Enabled = false;
}
Upvotes: 1