Problem with quote in Datagrid

  • Thread starter Thread starter Francois Soucy
  • Start date Start date
F

Francois Soucy

Hi,
I've the following code in a Datagrid template column. The code work very
well but I cannot acces anymore to the design mode. VStudio.net tell me that
I must have Quote arround <% %> tag. They are there.. I've try many thing
but no more design mode. Someone can tell me more?


<ItemTemplate>
<a href=javascript:popup(
'ShowPhoto.aspx?Id=<%#Container.DataItem("Kid")%>' )>
<img border="0" src='<%#Container.DataItem("TnPath")%>'>
</a>
</ItemTemplate>


Thank,
Francois
 
Hi Francois,

As for the problem you mentioned, it is a known behavior of the vs.net's
HTML EDITOR, it'll popup warning when there is nesting quotes. And here are
some means to work through it:

1. Using the ' at the top level and using " in the nested expressions.
For example:

<a href='javascript:popup("ShowPhoto.aspx?Id=<%#
DataBinder.Eval(Container.DataItem,"name") %>");'><img border="0" src='#'>
</a>

2. Also, since we can use serverside language(VB.NET or c#) to generate
the expression, the System.Convert.ToChar(int32) may help us to output the
quote mark in page template. For exampe:

<a href='<%# "javascript:popup(" + Convert.ToChar(34) +
"ShowPhoto.aspx?Id=" + DataBinder.Eval(Container.DataItem,"name") +
Convert.ToChar(34) + ");" %>'>
<img border="0" src="#"></a>

BTW, if you're using C# , you can simplely using the \" to represent
string in expression, such as :

<div onclick='<%# "alert(\"" + DataBinder.Eval(....) + "\");" %>' ...>

Hope helps. If you have any other questions or ideas, please feel free to
post here. Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hi Francois,

Have you had a chance to check out the suggestions or have you got any
further ideas on this issue? If there're anything else we can help, please
feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Back
Top