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 6535209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:20:48+00:00 2026-05-25T10:20:48+00:00

I am new with MVC technology and I am trying to get going slowly

  • 0

I am new with MVC technology and I am trying to get going slowly learning this technology.
I have one problem, which I think is fairly simple but I can’t find any solution.
I have a view with this code:

<script runat="server">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {

    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%: ViewData["Message"] %></h2>
    <form id="submitForm" runat="server">
    <p>Enter URL: <asp:TextBox ID="txtOne" runat="server" />&nbsp;<asp:Button 
            ID="btnSubmit" runat="server" onclick="btnSubmit_Click" Text="Submit" />
&nbsp;<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
            ControlToValidate="txtOne" Display="Dynamic" 
            ErrorMessage="Website URL not valid." 
            ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?"></asp:RegularExpressionValidator>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="txtOne" Display="Dynamic" ErrorMessage="Please enter URL."></asp:RequiredFieldValidator>
    </p>
    </form>
</asp:Content>

And I have the controller code where I have a method:

 public ActionResult isValidURL(string url)
        {
            if (Regex.IsMatch(url, @"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?"))
            {
            }
            return View();
        }

How can I call the isValidURL when the button is clicked and pass a parameter as well?
Thanks in advance Laziale

  • 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-25T10:20:48+00:00Added an answer on May 25, 2026 at 10:20 am

    You should use simple html or special HTML helpers, but not asp.net controls starting from <asp:

    Firstly you need to remove button click handler. Then you need to name your text box with url as “url” it should equal to the name of the isValidURL() method parameter. After that make sure that your button is submitting form to the following url {your controller name}/isValidURL. And that when you will click your button, form will be submitted to the server and your isValidURL method will be executed.

    What is going on behind the scenes

    Very roughly, but gives basic understanding of what is going on. ASP.NET MVC uses naming convention for form and url parameters. If you are sending HTTP request via GET or POST ASP.NET MVC parses it using routing rules you’ve registered, runs your controller and corresponding action, e.g. you posted http request using GET to "http:/localhost/controller1/Action1?x=8". In this case ASP.NET MVC will try to run Controller1 and then its method called Action1 with the following signature “Action(int x)”.

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

Sidebar

Related Questions

I'm going to try this new cloud technology. So I think the best place
I'm recently new in MVC technology and i'm with a difficult I have a
New to MVC, so hopefully this will be pretty simple. I have an HTML
I have a new MVC application which integrates into a larger pre-existing intranet site.
I am trying to get into the mvc technology and I am reading a
i have a problem in MVC ASP.NET project. i work with LINQ technology.When i
Im using the New MVC Web Api I have something like this: public class
I was just going through the new MVC Music Store tutorial at asp.net. One
I'm planning to design simple website using ASP.NET MVC new technology. Many concepts are
I am new to ASP.NET MVC, and the ASP.NET technology in general, so, please,

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.