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

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -