locked
Form field errors RRS feed

  • Question

  • User-1793215261 posted

    Hello

    I am getting a couple of green underline errors with an input field (Name) in my contact.aspx form. In that file, I have (stripped):

     <asp:Label runat="server" AssociatedControlID="user_name">Name</asp:Label>
          <asp:TextBox runat="server" ID="user_name" TextMode="Name" />
          <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
          <asp:RequiredFieldValidator runat="server" ControlToValidate="user_name"</asp:RequiredFieldValidator>

    One error is with TextMode="Name" in this line:

    <asp:TextBox runat="server" ID="user_name" TextMode="Name" />

    Error: The values permitted for this attribute do not include 'Name'.
    Parser Error Message: Cannot create an object of type 'System.Web.UI.WebControls.TextBoxMode' from its string representation 'Name' for the
    'TextMode' property.

    My message field follows the same format as above and I am not getting any errors there.

    The other green underline is here:

    <asp:RequiredFieldValidator 

    Error: Element 'RequiredFieldValidator' is missing the '<' from its start tag (when it is clearly not).

    Thanks!

    Monday, April 15, 2019 9:19 AM

Answers

All replies

  • User-943250815 posted

    One error is with TextMode="Name"

    Correct there is no "Name" for TextMode, usually allowed values are presented by Intellisense or control properties in VS.
    Anyway TextMode use values from TextBoxMode enumerator.
    https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.textboxmode?view=netframework-4.7.2

    For RequiredFieldValidator, you missing ">"

    <asp:RequiredFieldValidator runat="server" ControlToValidate="user_name"></asp:RequiredFieldValidator>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 15, 2019 12:12 PM
  • User-1793215261 posted

    Many thanks, jzero, for pointing out the error in my RequiredField, and for the link!

    Best regards

    Monday, April 15, 2019 2:47 PM