Support for select inputs

2 views
Skip to first unread message

Rob Scaduto

unread,
Oct 2, 2009, 7:11:11 PM10/2/09
to FubuMVC Development Group
Hello,

I'm new to FubuMVC but and I really love the project and its
direction. I just wasn't thrilled with ASP.NET MVC and was looking
for an alternative. Based on the posts I've read I'm probably in good
company.

Anyway I am working on my first project and I couldn't find a built in
way to bind a drop down list input to the model using the framework.
I did some searching but I couldn't find anything. So I implemented
my own DropDownListExpression and I wanted to submit it for feedback.

Here is the code for the DropDownListExpression:
http://codepaste.net/uhwdim

The HtmlExtension to call from the view:
http://codepaste.net/o4bsnj

A typical usage:
http://codepaste.net/kx65df

Supporting tests:
http://codepaste.net/agzneo

Features:
- Supports rendering option tags with or without a value attribute.
- Supports creating option tags from a list of custom objects or just
plain value types.
- You can provide a prompt value (like "Please select a value").

If there is already an elegant way to do this, then at least I learned
something. :)

Cheers
Reply all
Reply to author
Forward
0 new messages