Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Apologies if this is a pretty basic question but I'm a relative SharePoint newbie and I've been trying to find an answer for this for a couple of days.

I have an SPToolBarButton that provide Delete functionality via its OnClick. However, I need to prompt the users with an 'Are you sure?' Yes/No modal dialog box.

I have attempted to use OnClientClick="return confirm('Are you sure?')" but can't find a way of picking up the user's selection from within my code-behind page.

Is this even the correct approach to use?

Thanks for reading.

share|improve this question

1 Answer 1

If the user clicks "Cancel" in the confirm then it will return false and the postback cancelled.

Since there is no postback then the code-behind doesn't actually run - so no check of which button clicked is needed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.