I have the following straightforward razor code:

<div class="form-group">
    @Html.LabelFor(model => model.BusinessName, new { @class = "col-sm-3 control-label" })
      <div class="col-sm-6">
          @Html.TextBoxFor(model => model.BusinessName, new { @class = "form-control" })
          @Html.ValidationMessageFor(model => model.BusinessName)
      </div>
</div>

I want to be able to wrap this all in a custom html helper, however, when reading about creating your own, I don't see how I would pass in the existing 'TextBoxFor' and 'ValidationMessageFor' helpers to the custom html helper constructor that I will be creating. Is there a way to do this, or will I be better looking at the output of the helpers I want to nest and create the necessary tags manually within my custom helper?

Related posts

Recent Viewed