Articles in this section
Category / Section

How to pass an array of integers in Json mode actions?

1 min read


To pass an array or a list of integers from the view to post action.


In order to pass the array value to the post action, you need to serialize the array value and pass the serialized data to the mapper action. In the post action, you can de-serialize the serialized data and use the data based on your requirement.



int[ ] numbers={1,2,3,4,5};






   .Mappers(map => { map.Action("GridFeatures", new { numbersCollection = Newtonsoft.Json.JsonConvert.SerializeObject(numbers) }); })



using System.Web.Script.Serialization;

namespace Grid.Controllers


    public partial class GridController: Controller


 public ActionResult GridFeatures()


           return View();



        public ActionResult GridFeatures(PagingParams args, string numbersCollection)


            var numberdata = new JavaScriptSerializer().Deserialize(numbersCollection, typeof(int[ ]) );

                return data.GridJSONActions< Student>();




Note: Refer the System.Web.Script.Serialization library in the controller.

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment