Image inside a repeater

C

Chris Leffer

Hi.

I have an image inside a repeater that needs an onclick event,
dynamically generated. I have this code on my .aspx:

<IMG onclick='<%# "toggleDetails('" &
DataBinder.Eval(Container.DataItem,"code") & "',this);"%>'
src="../Images/show.gif" style="cursor: hand;" />

If I run the page, the code works ok, but when I try to see the page
through the design tab, I receive an error saying:

"Could not open in Design View. Quote values differently inside a
'<%..value" ... % block."

I have others calls to DataBinder on the same page, but they don't raise
any errors. What is wrong in my statement?

Regards,
Chris Leffer
 
F

fd123456

Hi Chris,

Your quotes and double-quotes are criss-crossed :

" this ' is " illegal '

Try to picture the quotes as brackets and the double quotes as
parenthesis, for instance; you'd get something like:

[ blah ( blah ] blah )

which cannot be evaluated. An enclosing of any kind cannot partially
overlap another enclosing. Sort your quotes/double quotes and you're
all set.

HTH.

Michel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top