HOY HOY - 2 months ago 16
ASP.NET (C#) Question

Confirmation box for LinkButton in Gridview before Rowcommand fires

I have a

gridview
, and a
linkbutton
on this gridview.

When linkbutton is clicked,
rowCommand
fires, however I want to ask user to comfirm the click with a comfirmation box,


  • if yes -> rowCommand fires,

  • if no-> nothing happens.



I couldn't find a way to it.

Answer

Add this as the LinkButton's OnClientClick property:

OnClientClick="return confirm('Do you really want?');"
Comments