troubleshooting Question

handling ' in javascript popup

Avatar of PatrickSweeney
PatrickSweeney asked on
ASP.NET
1 Comment1 Solution293 ViewsLast Modified:
Using .NET 2.0 with VB.NET
In a gridview, if you click the customer name, a popup window appears with a detailsview for the full customer details.
This is accomplished with the following code:

                    <ItemTemplate>
                        <a href="javascript:openPopup('details1.aspx?id=<%# Eval("ID") %>&bsm=<%# Eval("sales_dev") %>')"><%#Eval("customer_name")%></a>&nbsp;
                    </ItemTemplate>



The bsm parameter represents the person responsible for the lead.
The problem is that some of the people have apostrophes in their names. In this case the javascript string is truncated and the window does not open.
I know that apostrophes in javascript can be escaped by prefixing them with a backslash.
How would I get the backslash into the link?
ASKER CERTIFIED SOLUTION
Pratima Pharande

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros