Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: ViewContext.Writer.Write() inside @helper writes directly to the view instead of the HelperResult [517]

$
0
0
I'm trying to get result of @helper method as variable without writing it to the view (I'm going to do it later after some transformations). And inside this helper I'm using extension to the HtmlHelper which should write some code to the output of the helper. <br /><br />The simplest code would be like following:<br /><br />@helper SomeHelper() {<br /><b><br /> Html.ViewContext.Writer.Write("Hello world!"); //NOTE: this code is inside of HtmlHelper extension function in the library at nuget.<br /></b> <br />}<br /><br />And I want use this helper later on my page:<br /><br />@SomeHelper()<br /><br />And I will get following result:<br /><br />Hello World<br /><b></b><br /><br />But hello world should be inside of <b> tag, but it is outside. <br /><br />One possible solution is override Html.ViewContext.Writer.Write with helper's writer.<br /><br />PS: original problem is described there: https://github.com/danludwig/BeginCollectionItem/issues/3

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>