Ryan Adriano
Ryan Adriano

Reputation: 3

How to NOT automatically convert my single quotes to '

Hi I have a hyperlink in asp.net that I want to dynamically create. I also add additional attributes like onmouseover to call a javascript function. My problem is that instead of setting my attribute to

onmouseover="myJSFunc('param')" 

it converts it to

onmouseover="myJSFunc('param')". 

Any ideas how to get this to work in ASP.NET C#? Thanks!

Ryan

EDIT:

These controls are in a repeater. This is what I have in my code behind;

hypNav.Attributes.Add("onmouseover", "myJSFunc('" + divNav.ClientID + "')");

Upvotes: 0

Views: 3680

Answers (3)

x2.
x2.

Reputation: 9668

Seems to be .Net 4.0 issue. Check it out.

Upvotes: 1

Joel Coehoorn
Joel Coehoorn

Reputation: 415600

Use MyControl.Attributes.Add() in your code behind.

Upvotes: 0

Hari Menon
Hari Menon

Reputation: 35395

Tried using \' instead of ' ?

Upvotes: 0

Related Questions