Cleaner way to write this?

D

Darrel

I have a repeater control. Within it, I have a quoted HTML attribute that
contains a quotes javascript variable stsring which contains my asp.net tag.
To prevent nested quote issues, I have to write it like this:

<a href="javascript:;" onclick=<% response.write("""")
%>window.opener.document.getElementById('src').value='/slides/SM/<%#
DataBinder.Eval(Container.DataItem, "filename")
%>';javascript:window.close();<% response.write("""") %>><b>[sm]</b></a>

Is there a more elegant solution?

-Darrel
 
C

Cowboy \(Gregory A. Beamer\)

You can bind back a pointer to a method in the code behind and assemble the
JavaScript string there. The code behind will get a bit more extensive, but
it will be easy enough to feed the file name parameter and create the code
there. Your other option is to create a control that takes the file name and
outputs the proper JavaScript. you can then embed that control in the
Repeater.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top