Reputation: 752
I'm trying to show a title of a news as a link
@using Glass.Mapper.Sc.Web.Mvc
@model MVC.com.Models.News
it works:<a href="@Model.Url">@Model.Title</a><br/>
it dosen't work : @Html.Glass().RenderLink(x => x.Url,new {@class=""} ,true, Model.Title)
Anchor tag works fine but can not generate a link using RenderLink.
Meanwhile, is there any way I can eliminate @Html.Glass() helper from lines? I added Glass.Mapper.Sc.Web.Mvc to file Web.config but still have to wirte @Html.Glass() at the beginning of each command
Upvotes: 0
Views: 634
Reputation: 11
You can eliminate @Html.Glass() this way:
@using Glass.Mapper.Sc.Web.Mvc
@RenderLink(Model, x => x.Link, new { @class = "btn" }, true,Model.Title)
Upvotes: 1
Reputation: 121
i think you can do this which should eliminate @Html.Glass()
@inherits GlassView<News>
after that i think you should be able to do this.
@RenderLink(Model, x=>x.Url,new{@class=""},true)
Upvotes: 0