2

I just want to ask how to execute a jQuery script using an ASP button? I will be running a VB/C# code first to check the database connectivity. If it fails, I will prompt a jQuery dialog box.

To make it simple, it will run like this:

Button Clicked > Execute VB/C# command > run jQuery script

I know how to run a dialog box using jQuery from <button or <input tags but I cannot run both scripts from VB/C# and javascript.

Please help me,
Ivan

2
  • Yo, if this helps bruv. Learn about page cycles, if you keen I reckon take a look in here: :) stackoverflow.com/questions/12333455/… Yours question is very open-ended Commented Mar 17, 2014 at 2:48
  • The idea is to execute a .NET code first before executing jQuery so you can add .NET conditional statements or whatever you needed. On the link that you provided, it will only run a jQuery using an ASP control. :) Commented Mar 17, 2014 at 3:35

1 Answer 1

2

Let's assume you have a function in JavaScript or jQuery called

function runDialog() {
    console.log("Clicked");
    //Add your JQuery dialog code here
}

In C#, you then call this function like so

ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "runDialog();", true);

Hope this helps Cheers

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

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.