0

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.

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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:

http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/calling-an-Asp-Net-C-Sharp-method-web-method-using-javascript/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.