it is better to create a function that calls a helper. this should give you a hint how to implement yours
@functions
{
public HelperResult CustomFormTextboxFor<TModel,TProperty>(HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression)
{
var textBox= html.TextBoxFor(expression, new {@class = "highlight"});
var modelsMetaDatas = ModelMetadata.FromLambdaExpression(expression, html.ViewData);
string displayValue = modelsMetaDatas.DisplayName ?? (metaData.PropertyName ?? ExpressionHelper.GetExpressionText(expression));
return RenderCustomControl(textBox, displayValue);
}
}
@helper RenderCustomFormTextbox(MvcHtmlString input, string labeltext)
{
<label class="field">
<span class="td">@labeltext</span>
@input
</label>
}
The call of the function in you view will look something like this.
@CustomFormTextboxFor(Html, model => model.FirstName)
Hope this helps