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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:18:48+00:00 2026-05-15T11:18:48+00:00

so i’ve got an array of numbers that i’m posting to an asp.net mvc

  • 0

so i’ve got an array of numbers that i’m posting to an asp.net mvc action that has a list(of integer) parameter and it all works great.
my question is this:

Is it safe to assume that the list(of integer) will have the numbers in the same order as they were in the array i posted?

Thanks for your time!

EDIT:

The data being posted looks like this:

POSTDATA=model.LevelIds=6&model.LevelIds=19&model.LevelIds=16&model.LevelIds=21&model.LevelIds=18

I’m using the Tamper Data firefox add on to see it.

I’m using jQuery, in traditional mode.

EDIT:

the action looks something like this:

public function Create(byval model as thecreateviewmodel) as actionresult

the thecreatviewmodel has a bunch of properties, but the interesting one is…

Public Property LevelIdsAs IList(Of Integer) = New List(Of Integer)

on the client side the view model is build with javascript/jquery:

function NewEntityDataBuilder() {
    var theData = { 
        'model.Name' : $('#Name').val(),
        'model.Description' : $('#Description').val(),
        'model.LevelIds' : $('#LevelIds').val()
    };
    return theData;
}

that function is called from this bit of javascript which basically goes through the and adds all of the things in the list to a drop down list (select control) and selects them all.

$('#LevelIds').empty();
$('#AddedLevels').children().each(function () {
$('#LevelIds').append("<option value='" + $(this).attr('LevelId') + "'>" + $(this).attr('LevelId') + "</option>");
        });

$('#LevelIds').children().attr('selected', 'selected');  //select all the options so they get posted.

var dataToPost = NewEntityDataBuilder();   

this seems fairly convoluted when it’s put this way, but it’s actually fairly simple. it’s all part of 2 connected drag and drop lists that are part of a form.

so: if i put the value of a select list with all of it’s options selected in a variable and post that to an ilist(of integer) will ilist have them in the same order as they were in the select. It SEEMS like they are. but is that just a coincidence?

  • 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-15T11:18:48+00:00Added an answer on May 15, 2026 at 11:18 am

    Usually the index is part of the parameter name:

    ints[0]=0&ints[2]=2&ints[1]=1
    

    And if you have a controller action that looks like this:

    public ActionResult Index(List<int> ints)
    {
        // ints[0] = 0
        // ints[1] = 1
        // ints[2] = 2
        return View();
    }
    

    UPDATE:

    Let’s suppose that you have multiple parameters with the same name in the query string. This query string will be parsed by the ASP.NET engine by the native HttpRequest object be convert into a NameValueCollection and more precisely a custom implementation called HttpValueCollection. This class is internal to ASP.NET which means that it is not documented and it might change with versions of .NET. Looking at it with Reflector there is the FillFromString and the way it is implemented it seems to preserve the order. But this is something I wouldn’t rely on.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a

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.