Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7406603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:34:59+00:00 2026-05-29T05:34:59+00:00

I was looking for a simple way to control the data entered in a

  • 0

I was looking for a simple way to control the data entered in a form , I came to this solution that I can use six different validation server controls that are available for ASP.NET:

RequiredFieldValidator

CompareValidator

RangeValidator

RegularExpressionValidator

CustomValidator

ValidationSummary

but in order to use these controls I have to include runat=”server” in control tags and form tag.

the problem is when I want to specify a controller action in “action” attribute of “form” tag, It gives me the error:

Server tags cannot contain <% … %> constructs

Is there a way to use these controls and also call a controller action after submit?

here is my code:

<form name="register" action="<%: Url.Action("LogOn","Account") %>"  runat="server">          
    <div class="form_row">
        <label class="contact"><strong>Username:</strong></label>
        <asp:TextBox id="UserName" runat="server" type="text" class="contact_input"></asp:TextBox>
            &nbsp;
        <asp:RequiredFieldValidator id="RequiredFieldValidator1"  
            runat="server" ErrorMessage="Required!" 
            ControlToValidate="UserName">
        </asp:RequiredFieldValidator>
    </div>  

    <div class="form_row">
        <label class="contact"><strong>Password:</strong></label>
        <input id = "Password" name = "Password" type="password" class="contact_input" />
        <asp:RequiredFieldValidator id="RequiredFieldValidator1"  
            runat="server" ErrorMessage="Required!" 
            ControlToValidate="Password">
        </asp:RequiredFieldValidator>
    </div>                     

    <div class="form_row">
        <div class="terms">
            <input id = "RememberMe"  type="checkbox" name="terms" />
            Remember me
        </div>
    </div> 

    <div class="form_row">
        <input type="submit" class="register" value="login" />
    </div>   

</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:35:00+00:00Added an answer on May 29, 2026 at 5:35 am

    This looks like a very confused scenario. You describe an MVC project but you are using web form controls.

    If you are using MVC, I would replace the .net controls with standard HTML controls and use data annotations for your validation. See here for information.

    In MVC there should be no need to use runat="server" for anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to validate all the data on a form that
In any language really, im looking for a simple (very simple) way to control
I'm looking for a simple way to have this done. I would to have
This might have been asked before but I'm really looking for a simple way
Is there any mechanism that I can push data into a webbrowser control from
I am looking for a simple way to control the width of a \caption{}
I am looking for the most simple way to control JTextPane (its inner text)
I'm looking for a simple control that will allow the user to upload an
I'm looking for a simple way to encrypt my soap communication in my C#
I am looking for a simple way to get a mime type where the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.