4

I'm wondering does the latest release of MvcContrib work with the Razor view engine? I referenced the MvcContrib assembly and the FluentHtml assembly, then I added the required namespace to the ~/View/Web.config as suggested here by Darin. But still, no matter how much I try use the FluentHtml extensions in my views, it doesn't work. (nothing shows up in intellisense when I start with a dot after the html helper)

Am I missing anything?

P.S: this is the first time I use MvcContrib.

Community
  • 1
  • 1
Kassem
  • 8,116
  • 17
  • 75
  • 116

2 Answers2

5

I wrote a short blog that post covers using FluentHtml with Razor.

Regarding intellisense, you will only get intellisense for FluentHtml methods on "@this." (not "@Html.") and it only list the strong-typed helpers on views that implement IViewModelContainer<T> (such as ModelWebViewPage<T>). Another possible issue is Resharper. There is a workaround for that.

Tim Scott
  • 15,106
  • 9
  • 65
  • 79
0

I´m using mvccontrib and following darin answer it has to work. The steps I followed were:

  • copy-pasted in bin folder mvccontrib.dll and mvccontrib.fluent.dll

  • make a reference in references to those dll creating a reference for mvccontrib and mvccontrib.fluent.

  • two namespaces with the following names:
    add namespace="MvcContrib" add namespace="MvcContrib.FluentHtml"

  • in my controller I include using MvcContrib.Pagination;

  • finally I used in my view: @using MvcContrib.UI.Pager @using MvcContrib.Pagination

and rebuild. hope it helps..

s_h
  • 1,476
  • 2
  • 27
  • 61
  • Do I really need to copy them to the bin folder? I could actually import them with using statements, I just don't get any intellisense which means FluentHtml is not working. And actually, I added a using statement to my view to import the MvcContrib.UI.Pager namespace and then I tried @Html.Pager and it worked! So that's really confusing, what am I doing wrong with the FluentHtml?! – Kassem Mar 26 '11 at 22:29
  • trully I dont know, I passed to you the configuration that it was working to me. probably you could request additional info at http://groups.google.com/group/mvccontrib-discuss , I posted ten minutes ago and jeremy replied me asap. – s_h Mar 26 '11 at 22:35
  • check this info http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/92f10294e747c23/f4b0740279e66c48?lnk=gst&q=intellisense#f4b0740279e66c48 – s_h Mar 26 '11 at 22:39
  • A few things to note. Pager and Pagination are part of MvcContrib, not MvcContrib.FluentHtml. You shouldn't have to copy DLLs anywhere. Just reference them in your web project. It's nice to add MvcContrib.FluentHtml to namespaces in web.config, but you can just put a using statement in the markup where it is used. – Tim Scott Mar 27 '11 at 19:55