Link to home
Start Free TrialLog in
Avatar of msyed1
msyed1

asked on

VB.Net/ASP.Net - Programatically Enable HTML button

Hello,

I have a page that has both asp:buttons and HTML buttons.  The page does a Search.  When I first display the search page, all buttons (both asp and html) are disabled.   See example below:
==========================================================================
<asp:button id="BtnDelete" CommandName="Delete" tabIndex="15" runat="server" ForeColor="Crimson" Text=" Delete "
      Enabled="False" CssClass="ButtonClass"></asp:button>

<input class="ButtonClass" id="BtnDuplicate" onclick="javascript:BtnDuplicate_Click()"                               disabled tabIndex="16" type="button" value="Duplicate >>" width="70px">

<asp:button id="BtnClear" CommandName="Clear" tabIndex="17" runat="server" width="90px" Text="Clear Form"  
               Enabled="False" CssClass="ButtonClass"></asp:button>
===========================================================================

Once the Search is successful, I need to open up (Enable) all the buttons.  

My question is on the HTML Input button (BtnDuplicate - the 2nd one above) which is set to 'disabled' in the .aspx.   For ASP buttons, I know how to enable them (BtnDelete.Enabled = True), BUT HOW DO I PROGRAMATICALLY ENABLE A HTML BUTTON ???
I don't have an 'event' to go after either, the BtnDuplicate needs to be enabled after the search is performed and the record is successfully found on the database. Help, please...msyed1.
Avatar of PaulHews
PaulHews
Flag of Canada image

For this example, you would need a variable in code behind called mButtonsDisabled.  If true or false when the page is rendered, it will dynamically add/leave out the disabled attribute.

<input class="ButtonClass" id="BtnDuplicate" onclick="javascript:BtnDuplicate_Click()"                          <%=iif(mButtonsDisabled, "Disabled", "" %>  tabIndex="16" type="button" value="Duplicate >>" width="70px">

ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note that the variable should be Public...