Let's see (or guess) what Html.BeginForm()
does. In terms of "rendering," it usually just returns the start tag of the form to the html output. it is available because in this case it knows when the internal html content for the form has finished rendering, and it can display the end </form>
in its Dispose()
method. With all this, you get - firstly, open the form
tag than the custom html content you want, and after that comes the final tag. Result - you get the full html form in the output.
<form> ...contents(Result of Html.TextBoxFor, etc. helpers) </form>
I think your situation will be best resolved in case of form. At the moment, I donβt have much time to write the full code, but if you look at FormExtensions.BeginForm
, looking at the source code reflector (Thanks @druttka) (if you have an old version or a purchased license) or http: // wiki .sharpdevelop.net / ilspy.ashx and the explanations above, you can get a great point where from the beginning. Remove unnecessary code from the BeginForm method, create your MvcContentField: IDisposable class instead of MvcForm, change Dispose()
on it to display the end tag of the div, and you will get exactly what you need.
source share