I’m trying to create some HtmlHelper extensions and ran into a bit of a roadblock trying to get my extension methods to use attempted values defined by the ViewData.ModelState. The HtmlHelper.GetModelAttemptedValue() method is marked internal and isn’t available to my extension methods. Is there a simple alternative in MVC?
I’m trying to create some HtmlHelper extensions and ran into a bit of a
Share
I’m not sure what you’re going for here. Can’t you just use the ViewData.ModelState available to the HtmlHelper and invoke TryGetValue on it yourself? I understand that it not DRY, but it seems easier than trying to invoke the three-line method in the helper via reflection.