Last post Jul 01, 2018 01:51 PM by markfitzme
Jun 29, 2018 04:07 PM|newfcg|LINK
I am a beginner in programming and I'm trying to make some text boxes as fields required for a registration on a website and I am getting: "
Message Validation (ASP.Net): Attribute 'pattern' is not a valid attribute of element 'TextBox' " using this code: <asp:TextBox ID="name" runat="server" CssClass="txt" pattern="^[a-zA-Z\s]+$" title="Name"></asp:TextBox> and the same error validation when I'm
using"required"for the password box. Can someone help me out, please?
Jun 30, 2018 06:37 PM|mudassarkhan|LINK
Jun 30, 2018 11:11 PM|oned_gk|LINK
Seem like the patern combination is not valid try this
or try other patern
Jul 01, 2018 01:51 PM|markfitzme|LINK
That's correct, there is no pattern attribute on the ASP.Net textbox control. https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox(v=vs.110).aspx
and the same goes for required. Both were actually added with HTML 5. The textbox controls pre-date HTML 5.
You could, however, use the HTML controls in the System.Web.UI.HtmlControls namespace. In that case, you are using a standard <input> element with the a runat="server" attribute set. This gives you the ability to work with it on the server and avoid much
of the extra weight of the WebControls.