Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Add Overloads to InputExtensions xxxFor Methods With Id Prefix [145]

$
0
0
I don't know if this has happened to other people, but it has happened to me: the xxxFor methods in InputExtensions (TextBoxFor, LabelFor, etc) generate HTML content where the id and name attributes come from the property name. There is a problem if we use TextBoxFor, for example, on a view, two times with the same property names, even if they come from different classes.
So, I propose an overload (or the actual substitution of the current methods) for each of these methods that takes a prefix and applies it to the id attribute (not the name one, since this is required for binding to the model), such as:

public static MvcHtmlString TextBoxFor<TModel, TProperty>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression,
String prefix = null
)

This way, we avoid id clashes on the HTML, while preserving binding compatibility.
Comments: Any news on this? Any chance this may be implemented? Thanks!

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>