Call JavaScript AND C# function from a button
I am trying to run a routine that (when a button is clicked) changes an asp:label's text to "Please Wait..." using Javascript, and then goes away and runs a c# function that changes the asp:label's text to "Finished" when it is complete.
I can get the Javascript to work:
<asp:Button ID="Button1" runat="server" Text="Upload"
开发者_StackOverflow社区 onclientclick="document.getElementById('errorMessage').innerText='Please Wait...';" />
And I can run the c# bit fine too:
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
But I can't figure out how to make them run together. (i.e. Javascript first, and then c#.
Cheers for any advice,
Ben
OK - that was obvious:
<asp:Button ID="Button1" runat="server" Text="Upload"
onclientclick="document.getElementById('errorMessage').innerText='Please Wait...';"
onclick="Button1_Click" />
Thanks anyway!
Ben
精彩评论