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

TextBoxFor: INumber type but with default value = ""

user4157 Published in September 19, 2018, 6:44 pm

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.

share|improve this question

1 Answer 1

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO