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

  • Home
  • SEARCH
  • 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 6034103
In Process

The Archive Base Latest Questions

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

I am using three partialview on a single view, I have a submit button

  • 0

I am using three partialview on a single view, I have a submit button on clicking of which I want to send information to database, I have to retrieve data from all the partialview.

Can You please provide me correct information to do it.

Darin I m using L2S so when I drag my stored procedure, I get code some thing like this in

                 [global::System.Data.Linq.Mapping.FunctionAttribute(Name="SP_Name")]
    public int SP_Name(
                [global::System.Data.Linq.Mapping.ParameterAttribute(Name="EmployeeID", DbType="Int")] System.Nullable<int> EmployeeID
{

      IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), EmployeeID);
        encounterID = ((System.Nullable<int>)(result.GetParameterValue(293)));
        return ((int)(result.ReturnValue));
    }
} 

Updated

   <script language="javascript" type="text/javascript">
    $(function () {
        $('#Form1').submit(function () {
            $.ajax({
                url: this.action,
                type: this.method,
                data: $(this).serialize(),
                success: function (data) {
                    var message = data.Result;
                    $('#Result').html(message);

                }
            });
            return false;
        });
    });

</script>

In my Controller I am using

public ActionResult Index(FormCollection frm)
    {
     My Code ---------------------  
     return Json(new { Result = "Success" });
    }

When I return this I m getting a file in post back and it ask me to save it.
I have checked using flidder, in URL it shows me that the path as / only
where as If I fill any particular partialview It shows something like /Controller Name/Partialview

Can You help me with this problem

  • 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-23T05:34:52+00:00Added an answer on May 23, 2026 at 5:34 am

    Well, sending data to a controller action is usually done by performing an HTTP request to this controller action. There are different ways of performing an HTTP request:

    1. Use a <form> tag pointing to this action
    2. Use AJAX

    So if you go with the first approach you could have a single <form> wrapping all the partials which would have multiple submit buttons (with different names). Then when you click on one submit buttons all the input fields will be sent to the controller action and then inside the controller action you could process the data based on which submit button was clicked.

    If you use the second option, well, then simply harvest the values you need to be sent uipon button click and send them along the AJAX request.


    UPDATE:

    As requested in the comments section here’s how the first technique could be put into action. It uses two partials instead of three but it could be easily extrapolated.

    As always you start by defining a view model which will represent the data you would like to work with on this particular view:

    public class MyViewModel
    {
        public Partial1ViewModel Model1 { get; set; }
        public Partial2ViewModel Model2 { get; set; }
    }
    
    public class Partial1ViewModel
    {
        public string Foo { get; set; }
    }
    
    public class Partial2ViewModel
    {
        public string Bar { get; set; }
    }
    

    Then a controller:

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var model = new MyViewModel
            {
                Model1 = new Partial1ViewModel { Foo = "foo" },
                Model2 = new Partial2ViewModel { Bar = "bar" },
            };
            return View(model);
        }
    
        [HttpPost]
        public ActionResult Index(MyViewModel model)
        {
            // Here you have access to model.Model1.Foo and model.Model2.Bar =>
    
            var button = "";
            if (!string.IsNullOrEmpty(Request["submit1"]))
            {
                // submit1 button was used
                button = "submit1";
            } 
            else if (!string.IsNullOrEmpty(Request["submit2"]))
            {
                // submit2 button was used
                button = "submit2";
            }
    
            var result = string.Format("thanks for submitting using {0}", button);
            return Content(result, "text/plain");
        }
    }
    

    and then a main view (~/Views/Home/Index.cshtml):

    @model MyViewModel
    
    @using (Html.BeginForm())
    {
        @Html.EditorFor(x => x.Model1)
        @Html.EditorFor(x => x.Model2)
    }
    

    and the two corresponding editor templates (or partials if you will):

    ~/Views/Home/EditorTemplates/Partial1ViewModel.cshtml:

    @model Partial1ViewModel
    <h2>Partial 1</h2>
    <div>
        @Html.LabelFor(x => x.Foo)
        @Html.EditorFor(x => x.Foo)
        <input type="submit" value="Submit me!" name="submit1" />
    </div>
    

    ~/Views/Home/EditorTemplates/Partial2ViewModel.cshtml:

    @model Partial2ViewModel
    <h2>Partial 2</h2>
    <div>
        @Html.LabelFor(x => x.Bar)
        @Html.EditorFor(x => x.Bar)
        <input type="submit" value="Submit me!" name="submit2" />
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to expose a single API call using three different authentication mechanisms: django's
I have three images and using the following code I have then fade in
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
I have three applications that talk to each other using sockets. They can all
I am using jquery UI tabs I have three ajax tabs like so: <div
How create View page which is composed of three partial view pages? I am
I'm using ASP.NET MVC 2. Keeping it simple, I have three payment types: credit
I have a partial view that I am using from 2 different forms. In
i have as asp.net-mvc website and we are migrated a popup from using PartialView()
If I have the below PartialView <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<Models.Photo> %> <% using (Html.BeginForm(MyAction,

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.