[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

change style of submit button on top and bottom of the page

I have a submit button on top and bottom of the page, when the user clicks on either button, I want to change the image on the button and disable both the buttons.

I have the code to do achieve this just on the buttons that were clicked. Please suggest how I can add the code for both the buttons to do the same. thanks

 ibtnPlaceOrder.Attributes.Add("onclick", _
                                "src='/Assets/Images/Checkout/PlaceOrder_Disabled.jpg'; this.disabled = true;" _
                                    + Page.ClientScript.GetPostBackEventReference(New PostBackOptions(ibtnPlaceOrder)))
               
                    ibtnPlaceOrderTop.Attributes.Add("onclick", _
                               "src='/Assets/Images/Checkout/PlaceOrder_Disabled.jpg'; this.disabled = true;" _
                                   + Page.ClientScript.GetPostBackEventReference(New PostBackOptions(ibtnPlaceOrderTop)))
0
TrialUser
Asked:
TrialUser
2 Solutions
 
CodeCruiserCommented:
You need to add a function in javascript which disables both buttons and changes the image. Then call this function in the onclick above.
0
 
Ramkisan JagtapLead DeveloperCommented:
<script language="javascript" type="text/javascript">
   function ButtonOnClick()
   {
        var btn1=document.getgetElementById("<%=Button1.ClientId%>");
        var btn2=document.getgetElementById("<%=Button2.ClientId%>");
        btn1.disabled=true;
        btn2.disabled=true;
        btn1.src='/Assets/Images/Checkout/PlaceOrder_Disabled.jpg';
        btn2.src='/Assets/Images/Checkout/PlaceOrder_Disabled.jpg';
   }
</script>
 
    <div>
      <asp:Button ID="Button1" runat="server" Text="Button"
            OnClientClick="ButtonOnClick()" onclick="Button_Click1"  />
      <asp:Button ID="Button2" runat="server" Text="Button" OnClientClick="ButtonOnClick()" onclick="Button_Click1" />
    </div>

Call ButtonOnClick() onClientClick which will disable your button and chnge the back ground image.
Call Button_Click1 onClick Event Which will execute your server side code.

Hope this will help you.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now