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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:58:38+00:00 2026-06-07T22:58:38+00:00

I’m passing to single JSON type parameter and multiple JSON type parameters to Asp.Net.

  • 0

I’m passing to single JSON type parameter and multiple JSON type parameters to Asp.Net.

and in Asp.Net, I need to figure out the parameter is single data or multiple data to update DB (EF, Repository pattern).

[Single]

enter image description here

[Multiple]

enter image description here

Firstly, I tried like this,

[HttpPost]
public ActionResult ItemUpdate(WEBORDERLN ln ,IList<WEBORDERLN> lns)
{

but it comes to ln always. it never go to lns 🙁

[HttpPost]
public ActionResult ItemUpdate(WEBORDERLN ln)
{
// it works for only single update

and

[HttpPost]
public ActionResult ItemUpdate(IList<WEBORDERLN> lns)
{
// it works for only multiple update

How I figure out, the JSON type parameter is single or multiple?

anybody know, please advice me.

Thank you!

[EDIT]

enter image description here

[HttpPost]
public ActionResult ItemUpdate(WEBORDERLNS lns)
{
    try
    {
    EFWebOrderLnRepository webOrderLn = new EFWebOrderLnRepository();

    log.Debug("Count : "+lns.lns.Count.ToString()); // Object reference not set to an instance of an object.    
    log.Debug(lns.lns.Count());  //null, error : Value cannot be null
    log.Debug(lns.lns.Count().ToString());  //null, error : Value cannot be null

    foreach (WEBORDERLN ln in lns.lns)
    {
        webOrderLn.updateWebOrderLn(ln); // Error : Object reference not set to an instance of an object
    }
    .
    .
    .


public class WEBORDERLNS
{
    public IList<WEBORDERLN> lns { get; set; }
}

[EDIT]

Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection  keep-alive
Content-Length  875
Content-Type    application/json; charset=UTF-8
Cookie  user=38C6C07684B04645821CA5273EAB5B34340CE8CCA13A7D67DC748819B02C6963E4AD2A322068FC3090D3FE03EC81E663A5DED6FF2534E2595B40CF57EFF9BB544FFAC95CD79020E8A94019A3DC53B769EFC4049B6B9627E98AD9DBC1431BB5D99A47625B3353FA697A1CC005855C0248E95F61F7BD4A5362D75E5D01B395FB14E078524B8D0C7219AF959F9AED188AB30A16187DE166D5BD008B0013A65D470C52C9408C47FD42672B8FBABDB3524F77
Host    localhost:49995
Referer http://localhost:49995/
User-Agent  Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
X-Requested-With    XMLHttpRequest

[EDIT]

enter image description here

  • 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-07T22:58:40+00:00Added an answer on June 7, 2026 at 10:58 pm

    You would actually be far better off creating a Model class which represents an order set, with a collection of WEBORDERLN exposed as a property.

    public class OrderSet 
    {
       public List<WEBORDERLN> OrderLines { get; set; }
    
    }
    

    On your controller method, change the incoming parameter to:-

    [HttpPost]
    public ActionResult ItemUpdate(OrderSet orders)
    {
    // it works for only multiple update
    

    At that point, when receiving the model, you can just call the count mechanism on your OrderLines property.

    // How many orders?
    var orderCount = orders.OrderLines.Count;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.