Reputation: 3023
I have a asp button that while processing i would like the text on it.. How could achieve that?
<asp:LinkButton ID="loadImages" runat="server" CssClass="button"
onclick="loadImages_Click">Load Images</asp:LinkButton>
So when I click, it will change the Load Images to Loading... and then go back to the original state once it finishes.
I would appreciate any ideas.
Upvotes: 0
Views: 632
Reputation: 41675
<asp:LinkButton OnClientClick="this.innerHTML = 'loading'" ...
Once the page posts back the text will revert to "Load Images"
Upvotes: 3
Reputation: 35407
To change the text of a link when a user clicks on it use the onclick
JavaScript event:
window.addEventListener('load', function(){
var link = document.getElementById('<%=loadImages.ClientID %>');
link.addEventListener('click', function(){
this.innerHTML = 'loading ...';
}, false);
}, false);
This snippet will change the text of the link before the request to the server is made. Once the server responds the page will refresh with the newly rendered HTML from the response.
Upvotes: 1