asp.net mvc - How can I have multiple HtmlHelperExtensions in MVC3 -



asp.net mvc - How can I have multiple HtmlHelperExtensions in MVC3 -

i created 1 file , added htmlhelperextensions class.

public static class htmlhelperextensions { private const string nbsp = " "; private const string selattribute = " selected='selected'"; public static mvchtmlstring nbspifempty(this htmlhelper helper, string value) { var str = string.isnullorempty(value) ? nbsp : value; homecoming new mvchtmlstring(str); } etc...

now add together more files more htmlhelperextensions. when error saying:

duplicate definition: htmlhelperextensions

is possible me have more 1 of these classes?

just name class different. you're not allowed duplicate type names under 1 namespace.

here's tutorial on creating custom html helpers: http://www.asp.net/mvc/tutorials/creating-custom-html-helpers-cs.

asp.net-mvc

Comments

Popular posts from this blog

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

c# - Move local mssql database to webhosted MYSQL -

java - How to pass parameters between Request-Scoped Controllers? -