MOZILLA
MOZILLA

Reputation: 5980

Calling server event of a button in ASP.NET from Javascript

I have a button, I need to display a pop-up in javascript. So on its client click I call a javascript function which does that.

if user clicks "yes", I need to do a post back and call buttons server side click event, here is what I am doing inside the javascript function

__doPostBack(deleteLinkButton, 'Click'); 

' Where deleteLinkButton is a variable that has client Id of the button.

Postback happens but it does not go in the click handler for that button.

What can be wrong?

Upvotes: 2

Views: 6364

Answers (2)

Siddhanath Lawand
Siddhanath Lawand

Reputation: 11

Can be done like this:

document.getElementById('<%= Button.ClientID %>').click();

Upvotes: 1

Andreas Grech
Andreas Grech

Reputation: 108050

Try it like this:

__doPostBack('deleteLinkButton', 'Click');

Upvotes: 1

Related Questions