Add required attribute to a textbox - ASP.net

0

It is possible to add the required attribute in VB.net to a Textbox. I would assume it would be something like this: textbox.Attributes.Add("required") or is it necessary to insert JavaScript to implement it?

    
asked by Abraham Montes 23.05.2018 в 15:36
source

1 answer

0

Using the MVC pattern, you could add a Data Anotations in your model that indicates that data is required.

[Required]
public string Nombre { get ; set}

link

link

    
answered by 23.05.2018 в 15:40