Reputation: 153
I would like to accomplish an on click event to preform 2 functions sequentially
< onclick=" JavaScriptFunction() , C#ServerSideFunction()">
how would I go about this. I have found an example of how to do 2 javascript functions sequentially but not both.
Upvotes: 0
Views: 254
Reputation: 3248
Have it call a js function, and have that function call the js function you want first, and then call the C# function.
You can call a C# function from js using AJAX. Here's an example post about that:
Calling functions from an ASP.NET code file with javascript
And here's a whole blog post about calling C# from js:
Upvotes: 1
Reputation: 30892
What you'll essentially need to do is call a javascript function (which performs your client-side activities) which when finished makes your postback to the server.
In order for javascript to perform the postback you would use:
__doPostBack('<%=btnPlaceHolder.UniqueID %>', '')
as per this question.
Upvotes: 2