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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:42:44+00:00 2026-05-14T02:42:44+00:00

I have a controller method with the following signature: [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateValues(int id,

  • 0

I have a controller method with the following signature:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateValues(int id, MyViewModel[] array)
{
}

The id is normally picked up as part of the Url on other GET controller methods (I have a working route that does this)

I am successfully passing the array1 from the form in my view to the controller method, but how do I also put the id onto my Url so that when the user clicks the Submit button, the controller method will pick up the id?

  • 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-14T02:42:45+00:00Added an answer on May 14, 2026 at 2:42 am

    The id parameter might be set to optional: ASP.NET MVC 2 Optional URL Parameters which is default in ASP.NET MVC 2 so if there is not form element named “id” it will not be passed.

    Just pass the parameter you need as part of the form instead of part of the Url, as in:

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult UpdateValues(int UserID, MyViewModel[] array)
    {
    }
    

    and in your view:

    <%= Html.Hidden("userID", Model.UserID) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something similar to the following method: public ActionResult Details(int id) { var
Hey - I have the following method on my UITableView controller public void RemoveEventFromList(Event
I have a fairly standard .Net MVC Controller method: public ActionResult Add(Customer cust) {
I have a method with the signature public void setFoo(int newFoo) in a model
I have the following where I'm trying to send list/array to MVC controller method:
I have a controller method in ASP.NET MVC that looks like this: public ActionResult
I have a controller with an action method as follows: public class InventoryController :
I have the following form on an .NET MVC View: <form method=post enctype=multipart/form-data action=/Video/UploadDocument>
Hallo, I have following jquery code for calling ASP.NET MVC controller method that is
I have the following controller view method for my posts: function view($id = null)

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.