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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:34:22+00:00 2026-05-27T20:34:22+00:00

I am trying to bind a JSON stringified object to a model and few

  • 0

I am trying to bind a JSON stringified object to a model and few other strings in the controller and it is not working.

is it not possible,

$.ajax({
url: "/SrcManager/AddDataSource",
type: "POST",
data: JSON.stringify({
    content: ct,
    dataSourceName: $("#dataSrcName").val(),
    parameters: parametersCollection,
    sourceContentId: sourceContentId,
    sourceId: null,
    type: contType
}),
success: function (data) {
    if (data.length > 1)
    {
        alert("DataSource Saved Successfully");
        $("#dataSrcId").val(data);
    }
}
});

and var parametersCollection = [];

function IPParameters(paramName, paramValue) {
this.ParamName = paramName;
this.ParamValue = paramValue; }

*** action method : public string AddDataSource(ContentModel scvm){.........}

Why does the above not work. Is this not supported or any mistake in the code, kindly suggest the right way.

In the ContentModel, i map the parameters to List<Parameters>.

I have added the JsonValueProviderFactory also in global.asax.

The C# model is :

public class SourceContentViewModel
{
    public string sourceId { get; set; }

    public string dataSourceName { get; set; }

    public string sourceContentId { get; set; }

    public string content { get; set; }

    public string type { get; set; }
    public List<Parameters> parameters { get; set; }

    public SourceContentViewModel()
    {
        parameters = new List<Parameters>();
    }
}

public class Parameters
{
    public string ParamName { get; set; }
    public string ParamValue { get; set; }
}
  • 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-27T20:34:22+00:00Added an answer on May 27, 2026 at 8:34 pm

    You can’t send JSON to an ASP.NET MVC 2 application as there is no JSON provider factory out-of-the-box that will allow you to read the request. It is built in ASP.NET MVC 3. You may take a look at the following blog post and include the JsonValueProviderFactory discussed there. Then you will be able to send JSON requests to your ASP.NET MVC 2 controller actions after registering it:

    protected void Application_Start() 
    {
        RegisterRoutes(RouteTable.Routes);
        ValueProviderFactories.Factories.Add(new JsonValueProviderFactory());
    }
    

    Also notice the contentType: 'application/json; charset=utf-8' setting when sending the request which instructs the binder that you are sending a JSON request.

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

Sidebar

Related Questions

I'm trying to bind my view to my view model without DataObjectProvider. The following
I'm trying to bind the AJAX callback function to a certain scope, what am
I am trying to find a way bind Grid view to a JSON.NET parsed
I'm trying to create a controller for a custom complex object but have some
I am trying to bind Asp.Net Repeater Control for Ajax Data using DataTables Plugin
I have gone mad trying to bind the json string to the dropdown. Please
Im trying to bind a list with datetime objects to my repeater. if (e.Item.ItemType
I'm trying to bind a list of custom objects to a WPF Image like
I'm trying to bind the following shortcut: Ctrl + W to close tabs How
I'm trying to bind controls in a WPF form to an interface and I

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.