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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:06:44+00:00 2026-06-17T12:06:44+00:00

I am using JSON and bootstrap controls in my project. In my JSON I

  • 0

I am using JSON and bootstrap controls in my project. In my JSON I retrieve data from my sql database. Now I want to populate my select control with my data but it doesn’t work, I can’t see what I am doing wrong and I have searched lots of fiddles to get it to work.

This is my JSON ::

    var Projectss = function (data) {
        var self = this;
        self.ProjectName = ko.observable(data.ProjectName);
    }

    var ProjectModel = function (Projects) {
        var self = this;
        self.Projects = ko.observableArray(Projects);

    $.ajax({
            url: "CreateTask.aspx/GetProjectList",
            // Current Page, Method  
            data: '{}',
            // parameter map as JSON  
            type: "POST",
            // data has to be POSTed  
            contentType: "application/json; charset=utf-8",
            // posting JSON content      
            dataType: "JSON",
            // type of data is JSON (must be upper case!)  
            timeout: 10000,
            // AJAX timeout  
            success: function (Result) {
                var MappedProjects =
              $.map(Result.d,
       function (item) { return new Projectss(item); });
                self.Projects(MappedProjects);
            },
            error: function (xhr, status) {
                alert(status + " - " + xhr.responseText);
            }

        });
    };

    $(document).ready(function () {
        var VM = new ProjectModel();
        ko.applyBindings(VM);
    })

</script>

This is where I am trying to populate my select, this is inside of my td

div data-bind="foreach: Projects">
 select data-bind="options: $root.MappedProjects, optionsText: ProjectName, value: 'ProjectName'">
/select>
/div>
  • 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-17T12:06:45+00:00Added an answer on June 17, 2026 at 12:06 pm

    With the optionsText select binding option you need to specify your property name as string so you need to write 'ProjectName' (note the single quotes).

    However the value binding needs the property itself so you need to write ProjectName (note there are no quotes).

    So the fixed binding looks like this:

    <div data-bind="foreach: Projects">
        <select data-bind="options: $root.MappedProjects, 
                           optionsText: 'ProjectName', value: ProjectName">
        </select>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JSON in my project and am getting this data from JSON:
I'm using JSON-Framework in my project successfully to decode JSON send from a server.
I am using the Twitter Bootstrap lib on a new project and I want
I want to create a Dynamic Accordion control using Knockout JSON Mapping and Twitter
I'm using JSON to communicate some data through AJAX from the backend to the
I am using Json to retrieve elements from mysql and insert them into form
Im using JSON to post data from a form and ModelState.isValid() returning false, i
I'm using JSON.Net for serializeation. I need my data to look like this json
I'm using Json.Net to handle the deserialzing of the response of API calls from
I am using JSON.NET in C# to parse a response from the Klout API.

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.