ASP.NET syntax error highlighting and '"'

Hi,

The ASP.NET parser/error highlighting doesn't seem to handle '"' properly. For instance:

Text="<%# Eval (&quot;Body&quot;) %>"

This underlines the first 'quot' with the error "Cannot resolve symbol 'quot'", and pops up the suggestion 'System.Windows.Forms.VisualStyles.VisualStyleElement.Tab.Body" for 'Body'. I guess it's trying to interpret what's between the brackets as code, rather than treating the " as a double-quote, the way the ASP.NET parser does.

(I know I could just use single-quotes to delimit the databound expression in this case, so I could use real double-quotes in the Eval, but that's not an appropriate general solution in my case.)

Or have I done something wrong?

Cheers,

Geoff

5 comments
Comment actions Permalink

Geoff,

We do not support the feature. Here is a request
http://www.jetbrains.net/jira/browse/RSRP-59852 I've just created. For
temporary workaround you may replace these &quot; with single quotes.

--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Geoff Taylor" <no_replay@jetbrains.com> wrote in message
news:23438532.1204289544391.JavaMail.itn@is.intellij.net...

Hi,

>

The ASP.NET parser/error highlighting doesn't seem to handle '&amp;quot;'
properly. For instance:

>

Text="<%# Eval (&quot;Body&quot;) %>"

>

This underlines the first 'quot' with the error "Cannot resolve symbol
'quot'", and pops up the suggestion
'System.Windows.Forms.VisualStyles.VisualStyleElement.Tab.Body" for
'Body'. I guess it's trying to interpret what's between the brackets as
code, rather than treating the " as a double-quote, the way the ASP.NET
parser does.

>

(I know I could just use single-quotes to delimit the databound expression
in this case, so I could use real double-quotes in the Eval, but that's
not an appropriate general solution in my case.)

>

Or have I done something wrong?

>

Cheers,

>

Geoff



0
Comment actions Permalink

Hi,

Unfortunately I can't really use the single-quote workaround. The databound contents are generated rather than put there by me, so they could contain single-quotes, double-quotes, both or none. If I used single-quotes, I'd have to replace single-quotes in the databound expression with '&amp;#039;', which would just lead to the same problem.

Thanks for creating the request though - hope it gets fixed!

Many thanks,

Geoff

0
Comment actions Permalink

Try using single quotes to surround the Text attribute value, and use double
quotes within the server-side element:

Text='<%# Eval ("Body") %>'

Cheers,
Mike


"Geoff Taylor" <no_replay@jetbrains.com> wrote in message
news:19169816.1204292953316.JavaMail.itn@is.intellij.net...

Hi,

>

Unfortunately I can't really use the single-quote workaround. The
databound contents are generated rather than put there by me, so they
could contain single-quotes, double-quotes, both or none. If I used
single-quotes, I'd have to replace single-quotes in the databound
expression with '&amp;#039;', which would just lead to the same problem.

>

Thanks for creating the request though - hope it gets fixed!

>

Many thanks,

>

Geoff


0
Comment actions Permalink

Try using single quotes to surround the Text
attribute value, and use double
quotes within the server-side element:

Text='<%# Eval ("Body") %>'


That only works in that one case. As I said, the databound expression could contain single-quotes, double-quotes, both, or none. For example, this databound expression:

"document.location='MyPage.aspx?counter=" + Eval ("Counter") + "'"

contains both single-quotes and double-quotes, and should still be quoted when entered as an attribute value. The only way to do that without breaking the parser is to

  • substitute the double-quotes for &quot;, and surround the expression with double-quotes, as in:

OnClientClick="<%# &quot;document.location='MyPage.aspx?counter=&quot; + Eval (&quot;Counter&quot;) + &quot;'&quot; %>"

  • or substitute the single-quotes for &#039;, and surround the expression with single-quotes, as in:

OnClientClick='<%# "document.location=&#039;MyPage.aspx?counter=" + Eval ("Counter") + "&#039;" %>'

I'm fine with either of those options, really, but both break when using ReSharper. It's hard to find real errors on the page when every (correctly formed) attribute like those above is flagged in red.

Geoff

0
Comment actions Permalink

Ah, I understand now. I can certainly understand your frustration--I went
through the same pains with C# 3.0 and R# 3.1. I'm sorry I couldn't be of
more help.

Good luck,
Mike


"Geoff Taylor" <no_replay@jetbrains.com> wrote in message
news:7848608.1204298378750.JavaMail.itn@is.intellij.net...
>> Try using single quotes to surround the Text
>> attribute value, and use double
>> quotes within the server-side element:
>>
>> Text='<%# Eval ("Body") %>'
>

That only works in that one case. As I said, the databound expression
could contain single-quotes, double-quotes, both, or none. For example,
this databound expression:

>

"document.location='MyPage.aspx?counter=" + Eval ("Counter") + "'"

>

contains both single-quotes and double-quotes, and should still be quoted
when entered as an attribute value. The only way to do that without
breaking the parser is to

  • substitute the double-quotes for &quot;, and surround the expression

with double-quotes, as in:
OnClientClick="<%# &quot;document.location='MyPage.aspx?counter=&quot; +
Eval (&quot;Counter&quot;) + &quot;'&quot; %>"

>

  • or substitute the single-quotes for &#039;, and surround the expression

with single-quotes, as in:
OnClientClick='<%# "document.location=&#039;MyPage.aspx?counter=" + Eval
("Counter") + "&#039;" %>'

>

I'm fine with either of those options, really, but both break when using
ReSharper. It's hard to find real errors on the page when every
(correctly formed) attribute like those above is flagged in red.

>

Geoff


0

Please sign in to leave a comment.