Home TextBoxFor: INumber type but with default value = ""
Reply: 0

TextBoxFor: INumber type but with default value = ""

user652 Published in June 22, 2018, 11:30 am

I'm using Asp.net Core 2.0 and I have the following code:

@Html.TextBoxFor(model => model.personalData.sonsNumber, null, new { type = "number", value = "", required = "required", pattern="[0-9]" })

What I'm trying to is to use the validate feature that HMTL5 provides. The problem is that my model.personalData.sonsNumber is an int and has a number as default value and I need that the default value be set as empty string ("").

I already tried the value="" and it is not working.

Can any one tell me how to accomplish that?

Thank you in advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.319042 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO