Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Smart EditorFor
Message
 
General information
Forum:
ASP.NET
Category:
MVC
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01560391
Message ID:
01560393
Views:
58
>Hi everybody,
>
>I have the following EditorFor in the Shared/ EditorTemplates directory:
>
>
><div class="editor-label">
>    @Html.Label((ViewData.ModelMetadata.DisplayName??ViewData.ModelMetadata.PropertyName),
>        new Dictionary<string, object>
>            {
>                { "for", ViewData.ModelMetadata.PropertyName }
>            })
></div>
>
><div class="editor-field">
>    @Html.TextBox("", (object)Model,
>        new Dictionary<string, object>
>            {
>                { "id", ViewData.ModelMetadata.PropertyName },
>                { "name", ViewData.ModelMetadata.PropertyName },
>                { "class", "text-box single-line"},
>                { "data-bind", "value: " + ViewData.ModelMetadata.PropertyName },
>            })
>    @Html.ValidationMessage(ViewData.ModelMetadata.PropertyName,
>        new Dictionary<string, object>
>            {
>                { "data-valmsg-for", ViewData.ModelMetadata.PropertyName }
>            })
></div>
>
>
>If I type ViewData. I don't get any intellisense, unfortunately :( I am wondering, is there a way to find the type of my model property in this code and if it's numeric type, I want to use my special numeric only textbox class (and input type = "number" - HTML5).
>
>I got this idea http://stackoverflow.com/questions/13984602/how-to-make-entry-field-to-allow-numbers-only-using-ef-and-data-annotations and that's what I was thinking yesterday night also myself, but if I can make this EditorFor smarter, I would not need a UIHint.
>
>Do you know if this is a doable idea or I should go with a separate Editor? Also, in case of the later idea, how can I use input type="number" instead of @Html.TextBox
>
>?
>
>Thanks a lot in advance.

Naomi, god love you, but you ask us to jump way too deep into your code. As John Baird advised you a few weeks ago, you have to debug as far as you possibly can and then ask for help on the crucial detail.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform