开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜