0

I am using the below code to display a div on button click event. Is there any way to call this button click event from C# code behind.

 $(document).on("click", '#AddNew', function (e) {
                    e.stopPropagation();
                    if ($NewEntry.is(":hidden")) {
                        $NewEntry.slideDown("slow", "easeOutBounce");
                        $NewEntry.slideDown("slow", "easeOutBounce");
                        $filter.slideUp("slow");
                        return false;
                    } else {
                        $NewEntry.slideUp("slow");
                        return false;
                    }
                });
8
  • 2
    C# is server side programming. JQuery is client side programming. So, my guess is a no! Commented Jun 27, 2014 at 5:16
  • You mean you want to call this event from serverside callback? Commented Jun 27, 2014 at 5:16
  • @Sid i need to open the popup from code behind. Commented Jun 27, 2014 at 5:21
  • you cannot, you need to understand difference between client side and server side Commented Jun 27, 2014 at 5:23
  • @user3710059 change your question then and dont post only jquery code, add code that you used for calling your code behind Commented Jun 27, 2014 at 5:26

1 Answer 1

1

use this code :

protected void myButton(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>myFunction(params...);</script>", false);
}

more read : Call jQuery function from ASP.NET code behind C#

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.