views:

97

answers:

2

If i add pageBaseType="Spark.Web.Mvc.SparkView" in my web.config (necessary to fix intellisense), somehow it does not render links (probably not only) correctly anymore.

This is how it's supposed to look like (and does, if page base type is not specified)=>

alt text

This is how it looks when base type is specified=>

alt text

Chrome source viewer shows identical page source code for both cases=>

<body> 
    <div class="content"> 
        <div class="navigation"> 
            <a href="/Employee/List">Employees</a> 
            <a href="/Product/List">Products</a> 
            <a href="/Store/List">Stores</a> 
            <div class="navigation_title"> 
                Navigation</div> 
        </div> 
        <div class="main"> 
            <div class="content"> 
<h2>Employees</h2>Nothing found...
&lt;a href=&quot;/Employee/Create&quot;&gt;Create&lt;/a&gt;           
            </div> 
        </div> 
    </div> 
</body> 

Developer tools does not=>

alt text

So - why my link gets htmlencoded (if that's what happens)? If it's default behavior, then how to render raw html?


Using latest Spark version, rebuilt with Asp.Net Mvc2 RC assemblies.

+1  A: 

is automaticEncoding set to true in the web.config?

<spark>
  <pages automaticEncoding="false">
  </pages>
</spark>
Shay Erlichmen
Aha... Thought it has something to do with unicodes/ascii. Just copy/pasted example and forgot about that. Anyway - how to override automatic encoding?
Arnis L.
just set it to false and use the H() when you want to encode something
Shay Erlichmen
That i understood. It's acceptable solution. Just wondering - if i can keep it true and still render html with something like `NH()`. :)
Arnis L.
O, Don't know, I don't have spark install here so I can't check it. I just had the same bug I solved it with automaticEncoding=false, let me know if you find something...
Shay Erlichmen
I'm too lazy to dive deep into spark source code at the moment. I'll just accept your answer. :)
Arnis L.
+1  A: 

You have 2 different problems here. First the encoding issue. Second the Quotes, those are ALL Chrome.
Chrome has enclosed your text and link inside a CDATA node. Something about your page has triggered it to render XHTML and as such it won't allow that text inside a DIV. Usually the XHTML namespace on the HTML element does it or your app is sending pages with the XHTML MIME type. But I have found testing in Chrome that other things about a page will kick it into XHTML mode like self ending tags and the like.

Nick Daniels