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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:35:08+00:00 2026-06-05T07:35:08+00:00

Problem is: I am using a textbox to get a string q and want

  • 0

Problem is:

I am using a textbox to get a string q and want to pass it to 3 different actions in search controller. i.e. action1(string q), action2(string q) and so on

Now syntax of my action:

 public ActionResult action1(string q)
  {
   var mydata = from p in fab //LINQ logic
                select new action1class
                { data1=p //assignment };
   return View("_partialAction1", mydata);
  }

Similarly there are two other actions.

I am using 3 different actions because my LINQ logic gets data from 3 different sources so there different mydata needs to be created.

My problem is: I am trying that when I click on ‘search’ Button of textbox then all the 3 actions should run and generate partial view one below other in some <div id="action1"> tags.

I tried to use ajax.BeginForm but it can only call one action at a time

@using (Ajax.BeginForm("action1", "Search", new AjaxOptions
{
    HttpMethod = "GET",
    InsertionMode = InsertionMode.Replace,
    UpdateTargetId = "action1",
    LoadingElementId="progress"
}))

Also I tried to use ViewModel but the problem is that I was unable to pass a bigger model to the view along with these mydata kind of data obtained in LINQ’s in the action. I have no clear idea of how to use viewmodel in this case.

Is the approach that I am using correct? Or can there be any other way? I want to show result of all actions with button click.

  • 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-05T07:35:09+00:00Added an answer on June 5, 2026 at 7:35 am

    There are two types of actions are in MVC framework. The first ones are the main actions and they are invoked from the browser one at a time. The second type are called as Child Actions and these actions can’t be invoked from the browser but from the views returned by the main actions. Multiple child actions can be called under a main action. So you have to look into child actions whether they help or not.

    Ex.

    // main action that returns a view
    public ViewResult Index()
    {
       var model = ...
       return View(model);
    }
    
    // couple of child actions each returns a partial view
    // which will be called from the index view
    [ChildActionOnly]
    public PartialViewResult ChildAction1()
    {
      var model = ...
      return PartialView(model);
    }
    
    [ChildActionOnly]
    public PartialViewResult ChildAction2()
    {
      var model = ...
      return PartialView(model);
    }
    
    // index view
    Index.cshtml
    @model ...
    
    @Html.Action("ChildAction1");
    @Html.Action("ChildAction2");
    
    ...
    

    http://msdn.microsoft.com/en-us/library/ee839451.aspx

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

Sidebar

Related Questions

I have problem while using jquery maskedinput with asp.net textbox. I have a check
I have a problem using Semaphore in threading.. this is my situation, i want
I am having a performance problem binding a large string to a a TextBox
I have a search field, and using that single text box I want the
My problem: I would like to validate the user input of a TextBox using
The problem: Using ASp.NET MVC for reporting. Given: 1. A report that is tabular
I've encountered a problem using AFNetworking to download files from a Rackspace repository. Basically
I have a problem using glOrtho in a program that uses GLMDraw() function of
I am having a problem using multiple And 's in a Case statement. My
I'm having a problem using the Google Prediction API. I don't know what information

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.