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
↧