ok say i have the following model:
public class bar{
public string bar {get; set; }
}
public class foo{
public bar mybar{get; set;}
public string anotherproperty{get; set;}
}
And in the UI i want to do this:
@Html.MyWhackyHelperFor(x=>x.bar)
which uses :
public static MvcHtmlString MyWhackyHelperFor<TModel, TValue>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TValue>> expression){
//how can i get a the actual bar object here?
}
how do i get at the actual part of the model being refered to?
You need to compile the expression into a method, then call the method: