ASP.NET syntax error highlighting and '"'
Hi,
The ASP.NET parser/error highlighting doesn't seem to handle '"' properly. For instance:
Text="<%# Eval ("Body") %>"
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
Please sign in to leave a comment.
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 " 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,
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 '&#039;', which would just lead to the same problem.
Thanks for creating the request though - hope it gets fixed!
Many thanks,
Geoff
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...
>
>
>
>
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 ", and surround the expression with double-quotes, as in:
OnClientClick="<%# "document.location='MyPage.aspx?counter=" + Eval ("Counter") + "'" %>"
or substitute the single-quotes for ', and surround the expression with single-quotes, as in:
OnClientClick='<%# "document.location='MyPage.aspx?counter=" + Eval ("Counter") + "'" %>'
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
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") %>'
>
>
>
>
>
>