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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:00:40+00:00 2026-06-03T15:00:40+00:00

I am currently working on an MVC3 ASP.NET application which requires the user to

  • 0

I am currently working on an MVC3 ASP.NET application which requires the user to fill out a few simple text boxes in a form and then hit the submit button.

When the submit button is clicked, the controller uses the inputs from the text boxes and uses LINQ to SQL to call a stored procedure query an SQL Database and return a table of data. Currently the submit button will display the data in a table on a new viewpage, however I’m looking to modify this to have the data table that is produced to load directly below the submit button without refreshing the page at all.

Now I understand the use of either AJAX or Jquery will be necessary, I’m just struggling to understand how to present the data without sending the user to a new page.

Form in the view page:

<% using (Html.BeginForm("RunQuery","RecentActivity"))
   {%>

    <fieldset>
        <legend></legend>
        <p>
            <label for="Name">Name:</label>
            <%= Html.TextBox("Name") %>
            <%= Html.ValidationMessage("Name", "*") %>

        </p>
        <p> <label for="StartDate"> Start Date:</label>
            <%= Html.TextBox("StartDate")%>
            <%= Html.ValidationMessage("StartDate", "*") %>

            <label for="EndDate"> End Date:</label>
            <%= Html.TextBox("EndDate") %>
            <%= Html.ValidationMessage("EndDate", "*") %>
        </p>

        <p>
            <input type="submit",id="submit", value="Submit" />
        </p>

      </fieldset>   
<% } %>

Controller:

    ModelDataContext db = new ModelDataContext();
    [HttpPost]

    public ActionResult RunQuery(string Name,string StartDate, string EndDate)
    {

        var results= db.lastndays(Name, StartDate, EndDate);
        return View(results.ToList());  
    }

Any help would be great, thanks.

  • 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-06-03T15:00:42+00:00Added an answer on June 3, 2026 at 3:00 pm

    you can try

    $(":submit").click(function(e){
     e.preventDefault(); //this will prevent the form from submitting
     var $name=$(":input[name='Name']");
     var $StartDate=$(":input[name='StartDate']");
     var $EndDate=$(":input[name='EndDate']");
     //if you are using unobtrusive validation
     if($('form').valid()){
     $.post("/",{Name:$name,StartDate:$StartDate,EndDate:$EndDate},function(data){
       if(data.results!='error')
           console.log(data.results);
      },'json');
    }else alert('form not valid');
    });
    

    in the controller

    [HttpPost]
        public JsonResult RunQuery(string Name,string StartDate, string EndDate)
        {
            var results= db.lastndays(Name, StartDate, EndDate);
            if(/*there are results*/){
             return Json(new{results=results.ToList()});  
             }else{
              return Json(new{results="error"});  
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working out of the Pro Asp.net mvc3 Framework book by Adam
I'm working on a large Asp.Net MVC3 application (>50 views) and we are currently
I'm working on MVC3 and currently creating a Forum application in asp.net. Forum allows
I am currently working on an ASP.NET MVC3 website. I have a simple authentication
I'm working with an ASP.net MVC3.0 application and I keep Current User information in
I am currently working on a ASP .Net MVC 3 application to do some
I'm currently working on an Intranet application project, using ASP.NET MVC 3. One of
Currently working on an ASP.NET MVC 3.0 application and using FormsAuthentication . When the
I am currently working on an ASP.NET MVC3 project in Visual Studio. I have
I'm currently reading a book about ASP.NET MVC3 to learn working with this framework.

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.