Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Html Helper extension
Message
 
To
All
General information
Forum:
ASP.NET
Category:
MVC
Title:
Html Helper extension
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01597009
Message ID:
01597009
Views:
41
Hi All, I downloaded some code that is supposed to extend the Html helpers to enable an Enum to be used as the datasource for a Dropdownlist, but I'm getting a compiler error of and I can't figure it out
Inconsistent accessibility: parameter type 'System.Linq.Expressions.Expression<BusinessLayer.Func<TModel,TProperty>>' 
is less accessible than method 'BusinessLayer.Extension.EnumDropDownListFor<TModel,TProperty,TEnum>
(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<BusinessLayer.Func<TModel,TProperty>>, TEnum)'
namespace BusinessLayer
{
public static class Extension
    {
public static MvcHtmlString EnumDropDownListFor<TModel, TProperty, TEnum>(
                    this HtmlHelper<TModel> htmlHelper,
                    Expression<Func<TModel, TProperty>> expression,
                    TEnum selectedValue)
        {
            IEnumerable<TEnum> values = System.Enum.GetValues(typeof(TEnum))
                                        .Cast<TEnum>();

            IEnumerable<SelectListItem> items = from value in values
                                                select new SelectListItem()
                                                {
                                                    Text = value.ToString(),
                                                    Value = value.ToString(),
                                                    Selected = (value.Equals(selectedValue))
                                                };
           
            return SelectExtensions.DropDownListFor(htmlHelper, expression,items);
        }
}
}
Regards,
Peter J. Kane



Pete
Next
Reply
Map
View

Click here to load this message in the networking platform