Using JavaScript confirm() in ASP.NET control OnClientClick property(ivanuzunov.net)

submitted by kichetokicheto(435) 5 years, 1 month ago

Have you tried using JavaScript confirm() function in ASP.NET Button, LinkButton or ImageButton client onclick property?

4 comments |category: |Views: 492

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by yesthatmcgurkyesthatmcgurk(4063) 5 years, 1 month ago 0

Great tip; put this one in the bag.

Reply

posted by crpietschmanncrpietschmann(11.3k) 5 years, 1 month ago 0

You dont’ really need to use an if statement within the OnClientClick since confirm returns true or false. Here’s a slightly simpler solution:

<asp:LinkButton ID=”lbtnDelete” runat=”server” CommandName=’DeleteItem’ Text=’Delete’ OnClientClick=”return confirm(’Are you sure you want to\ndelete this item?’);”></asp:LinkButton>

Reply

posted by photozphotoz(80) 5 years, 1 month ago 0

color me old, but using "return confirm " has been around quite awhile. nothing to see here... move on.

:-)

Reply

posted by simonebsimoneb(5450) 5 years ago 0

I posted a comment to the blog post saying: "Why not return Confirm()?"

He deleted the comment...

Reply

information Login or create an account to comment on this story