How to Call a extension method from library in asp.net mvc project inside the razor view ?

Posted by Anirudha on Geeks with Blogs See other posts from Geeks with Blogs or by Anirudha
Published on Thu, 12 Jun 2014 05:30:00 GMT Indexed on 2014/06/12 15:26 UTC
Read the original article Hit count: 165

Filed under:

Originally posted on: http://geekswithblogs.net/anirugu/archive/2014/06/12/how-to-call-a-extension-method-from-library-in-asp.net.aspx

If you want to call a extension method from a c# library when you are working on views then here in this post I am showing you how you can do it.

 

just go to views and open the web.config file. (do all these step in VWD or VS 13 whatever you use for work)

inside the tag of  system.web.webPages.razor you will find the tag  namespaces which contain too many namespace which shown in intellisense when you work in Views inside your Visual studio.

 

now  add line like this

  <add namespace="MyCustomDll" />

MyCustomDll is a namespace that came from library that I want to use in my views. Now whenever  I am working in views I can see the extension method in views.

 

Cheers

© Geeks with Blogs or respective owner