-
Website
http://old.wekeroad.com/ -
Original page
http://blog.wekeroad.com/blog/asp-net-mvc-dropdownlist-and-html-attributes/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
arezkiStoreFront
8 comments · 1 points
-
DotnetShadow
7 comments · 1 points
-
robconery
400 comments · 13 points
-
Tuna Toksoz
9 comments · 1 points
-
wpatterson
8 comments · 1 points
-
-
Popular Threads
tool, you can make a mistake (especially with a beta toolset) and it can be
icky. However we are in beta still so your feedback is welcomed.
We have an MVC app that has some pretty monster html forms, so I like to limit my <%= BlahHelper.foo() %> to just things that really take a lot of space or logic to render. For textboxes, hidden fields, and other run-of-the-mill controls, I have some server controls that do a lot of what HtmlHelper controls do, (binding, attribute inferring, etc...) with a little tweaking for internal stuff and a read-only mode for detail views.
Good luck on your book, btw; with you three writing that I can't imagine buying anything else. :)
Designers I worked with in the past just knew that they should avoid touching anything that comes in <% %> brackets - but they regularly tried to mess with custom serverside tags.
At the end it is all a matter of personal taste, right ;-))
cheers,
Elmar
You say new { foo = "to-may-to" }, I say <... foo="to-mah-to"/> applies here.
spelling error? additional close bracket?
thanks for this,
id LOVE to see this book, hopefully it has some good insight into the best ways for cascading dropdown and
check box lists!
You can read a sample chapter (that we're updating now). It's a bit rough,
but there's a sample there.
Specifically, the textbox helper overloads to something like string name, object value, object htmlattributes when it was previously string name, object htmlattributes (which is now string name, object value). My htmlattributes ended up being added to the value field during the recompile, which isn't a big deal. The annoying thing is that now to add the value parameter you basically need to test the model for null and then specify the actual property or you get an exception trying to reference a property from a null object. It becomes pretty verbose and I hope there is a better method I'm not thinking of, or that a better solution is in the release.
I run into the same issue with the object overload. It's about time for a better (i.e. Ruby like) syntax for dictionaries in C#.
This is the first time I heard about SelectList. Probably I missed a MVC StoreFront episode.
var categories = (from c in db.Categories select c).ToList();
added to the HTML as attributes. Better, for sure - but doesn't solve it.
http://weblogs.asp.net/leftslipper/archive/2007...
Nice example. Could you please show me the code to display result based on the dropdownlist selected value? How to do the dropdownlist selection changed?
and all i get is this "System.String[]"
now i tried this with looping as well but then it wont render and names beside the radio button..
http://altafkhatri.com/Technical/How_to_bind_IL...