Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3798464
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:34:36+00:00 2026-05-19T13:34:36+00:00

I wanted to add a confirmation box to my ImageButton, so I have the

  • 0

I wanted to add a confirmation box to my ImageButton, so I have the following:

btn.Attributes.Add("onclick", "return confirm('OK to delete this district from the consultant\'s list?');");

But then .NET html-encodes the whole thing so it comes out in the HTML as:

onclick="return confirm('OK to delete this district from the consultant's list?');" 

so the apostrophe in “consultant’s” looks the same as the apostrophes surrounding the confirm parameter, and javascript gets all confused, and the confirm box does not come up.

Deleting the “consultant’s” apostrophe solves the problem, but then I have an even more annoying punctuation error which is unacceptable.

What I seem to need is a “javascript” escape for the apostrophe, something that will escape the apostrophe only for javascript, not for HTML .. if that makes sense.

Any ideas??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T13:34:37+00:00Added an answer on May 19, 2026 at 1:34 pm
    btn.Attributes.Add("onclick", "return confirm(\"OK to delete this district from the consultant\'s list?\");");
    

    Escape " and use confirm("...")

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made this centered navigation bar, and I wanted to add a :active
I have a pretty slick website and I wanted to add a simple blog
Found this at MDC but how if I'd wanted to add a private variable
In continuation of the question at this link I wanted to add some functionality
I have a file selector (which works as needed) but I wanted to add
just wanted to add this Color Picker ( http://code.google.com/p/devmil-android-color-picker/source/browse/ ) to my app and
I wanted to add an Xcode project to an existing repository using the following:
I have an iPhone application which I wanted to add URL schemes to. The
I have a image button. I wanted to add a text Search on it.
For example take this paper [PDF]. If I wanted to add Weather degradation into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.