D
Dylan Parry
Hi,
I’d like to write some HTML helper extensions so that I can use some of
the HTML5 form fields within MVC2. Basically, where I’ve now got:
<%= Html.TextBoxFor(model => model.Date, String.Format("{0:g}",
Model.Date))%>
I’d like to be able to use something like:
<%= Html.DateBoxFor(model => model.Date, String.Format("{0:g}",
Model.Date))%>
and have it create HTML that looks like:
<input type="date" id="Date" name="Date" value="…" />
Likewise, I’d like HTML helpers for url, email, number, and all the
other HTML5 form fields.
I’m just not sure where to start. Ideally someone else would have
already written extensions for these elements, but I can’t find any
anywhere.
Does anyone have a link to a tutorial that explains how to create
strongly-typed HTML helpers? Or failing that, is anyone here able to
point me in the right direction with a bit of starter code?
Cheers,
I’d like to write some HTML helper extensions so that I can use some of
the HTML5 form fields within MVC2. Basically, where I’ve now got:
<%= Html.TextBoxFor(model => model.Date, String.Format("{0:g}",
Model.Date))%>
I’d like to be able to use something like:
<%= Html.DateBoxFor(model => model.Date, String.Format("{0:g}",
Model.Date))%>
and have it create HTML that looks like:
<input type="date" id="Date" name="Date" value="…" />
Likewise, I’d like HTML helpers for url, email, number, and all the
other HTML5 form fields.
I’m just not sure where to start. Ideally someone else would have
already written extensions for these elements, but I can’t find any
anywhere.
Does anyone have a link to a tutorial that explains how to create
strongly-typed HTML helpers? Or failing that, is anyone here able to
point me in the right direction with a bit of starter code?
Cheers,