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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:31:34+00:00 2026-06-09T05:31:34+00:00

I am creating a .Net web service to receive and process serialized form data

  • 0

I am creating a .Net web service to receive and process serialized form data from JQuery.form.js which has a couple of multiselects contained within the form.

The serialized data sent to the webservice includes content like this:

&travelwith=4&travelwith=5&travelwith=6

for the field ‘travelwith’ showing that a multi-selection of 3 items out of 10 available in the form’s select field.

Can I construct a strong typed class with the following for instance:

public class StoreUserSet
{
public Array travelwith { get; set; }
public string otherfield { get; set; }
....
}

and then have my web method take the object like this:

StoreUserSet StUserSet = new StoreUserSet(); // Create new class instance.

[WebMethod()]
public bool ProfSet1(StoreUserSet StUserSet)
{
...
}

Would the various values of the multiselect field ‘travelwith’ automatically be parsed into the Array travelwith of the class so that I can save the 3 item values as a comma separated list into SQL via LINQ ?

I haven’t got this far yet.. thought I’d get feedback on my planned approach.

Thanks for any feedback,
Martin.

  • 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-09T05:31:36+00:00Added an answer on June 9, 2026 at 5:31 am

    ok, seeing as my KeyLargo site’s JQuery form contained both single select form data and multiple selects, I needed to be able to store the multiple selects in a single field within Sql.

    I ran into problems trying to handle the multiple selects on the server using Array type for storing the data in a Sql single field with a comma delimited string. So the way I solved my question above was to create the strongly typed class with string[] to capture the serialized multi select data passed via AJAX to the server:

    public class StoreUserSet
    {
    public string[] travelwith { get; set; }
    public string otherfield { get; set; }
    ....
    }
    

    I used Rick Strahl’s handy method to handle multiselect array data being passed from the client:

    public static string[] FormMultiple(this  NameValue[] formVars, string name)
    {
    var matches = formVars.Where(nv => string.Equals(nv.name, name,
    StringComparison.OrdinalIgnoreCase)).Select(nv => nv.value).ToArray();
    return (0 == matches.Length) ? null : matches;
    }
    

    To iterate through the array setting values like this:

    profile_travelwith = formVars.FormMultiple("profile_travelwith");
    

    Then joined the values in the multi select string[] arrays like this:

    profile_travelwith = string.Join(",", StUserSet.profile_travelwith);
    

    Easily enabling me to save the data into the relevant table fields of the profile.

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

Sidebar

Related Questions

I am creating iphone application which will require data from .NET web services. I
I'm creating a web service that'll be called from a web form in asp.net.
I have ASP.NET web service, which is creating file in XML table format. I
I am creating a large ASP.NET 4 site which has a WCF service backend.
I am creating a web service in ASP.NET that needs to be accessed from
I have a user interface in .net which needs to receive data from a
I'm creating a web service (asmx) using asp.net mvc 3 and it has a
I create an asp.net 4.0 web application which has a web service for uploading
I'm creating REST service using ASP.NET Web API. How can I return 401 status
I'm creating a .net app that manages some feeds from various web services. I've

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.