Questions tagged [knockout-mvc]

Knockout MVC is a web framework for ASP.NET MVC based on the popular Knockout.js JavaScript library. It allows easy creation of feature-rich applications based on Model-View-View Model (MVVM) pattern.

Knockout MVC is a web framework for ASP.NET MVC based on the popular Knockout.js JavaScript library. It follows the Model-View-View Model (MVVM) pattern, in which the user interface can be bound to a separate existing data model such that any change of the model will automatically update of interface.

Knockout MVC follows the concepts of the Knockout.js library, but uses server-side .NET classes as models instead of JavaScript as used by plain Knockout.js. Knockout MVC allows the creation of Rich Applications without the need to write JavaScript by dynamically generating some JavaScript on the server based on C#/VB.net code, and by using more server-side processing.

273 questions
2
votes
3 answers

knockoutjs MVC 4 computed values

I have the following viewModel var viewModel = new myViewModel([{ Name: "Name", price: 32, tax: 22, }, { Name: "Name", price: 32, tax: 22, }]); I have a…
2
votes
1 answer

Knockoutjs dynamic templating and applying jquery effects to visibility transition

Im using knockout js dynamic templating successfully to display different views depending on whether the user has clicked to view further details of an item. basic code included below :
Kramer00
  • 1,167
  • 3
  • 12
  • 34
2
votes
1 answer

Knockout mapping of nested array

This is my javascript that grabs the data and calls the mapping: function loadData() { currentViewModel.isLoading(true); $.get('/api/myevents/' + eventId, null, function (data) { var details = ko.mapping.fromJS(data); …
codedog
  • 2,488
  • 9
  • 38
  • 67
2
votes
1 answer

Knockout: Mapping/binding JSON issue

i'm trying a basic hello work example getting json, auto mapping it and then binding to an observable, I'm sure i'm getting something basic wrong. JSON returned from ajax call "{\"Content\":\"hello world\"}" JS function ViewModel() { var self =…
1
vote
1 answer

Remove duplicates or distinction from array of objects by knockout.js

How to remove duplicates objects from an array by using Knockout.js var ticketgroups = [ {TicketGroup: TicketGroup1, SortOrder: 1}, {TicketGroup: TicketGroup1, SortOrder: 1}, {TicketGroup: TicketGroup2, SortOrder: 2}, …
1
vote
1 answer

ASP.NET MVC Knockout button click call POST API

I have a table (list) on my front end in html, and foreach row, I have a button: ... ... and in the .js file I have something like this: define(['viewmodels/shell',…
Stefan0309
  • 1,602
  • 5
  • 23
  • 61
1
vote
1 answer

data subscribed to Knockout ObservableArray but displaying empty array

I'm new to javascript. i'm having difficulty printing the data from the location ObservableArray. The data - bind works and i could list out the data from the location ObservableArray at the view but can't print it out on the console. i have been on…
Fred Brume
  • 13
  • 4
1
vote
1 answer

KnockoutJS - Data Binding After Click Event

I would like to update the First# or Second# text after click event. It's now update when I focus out from input fields. Here's a link. function ViewModel () { self.this; self.var1 = ko.observable(50); self.var2 =…
siuri
  • 191
  • 2
  • 13
1
vote
1 answer

Applying style to particular cell in knockout JS dynamic table depending upon it value

I don't have any experience in Knockout js but since I have to implement the functionality and struggling to get my hands on this scenario. JSP files are fetching JSON data and it is passed to HTML template to create dynamic table.But i have to…
Pratswinz
  • 1,476
  • 11
  • 24
1
vote
1 answer

Knockout doesn't update when the array changes?

I have a Knockout UI where I am putting objects into observables. Once you click an add to cart button that updates the object, the ui doesn't update. Once you refresh the page it will update. I have heard to a lot of people having this TYPE of…
QueSo
  • 269
  • 1
  • 3
  • 11
1
vote
1 answer

Unable to bind default value to dropdown in knockoutJS

I am having two dropdown (PrimarySpeciality,PrimarySubSpeciality), based on the value in one dropdown(PrimarySpeciality) the other dropdown(PrimarySubSpeciality) value should change. On Load, I want the 'PrimarySubSpecialities' on load to default…
AMDI
  • 895
  • 2
  • 17
  • 40
1
vote
1 answer

how to bind input type= 'email' in knockoutjs

I am using KnockoutJS with MVC. I want to know whether the emailId is valid or invalid and based on it i have to enable/disable button and set error title for textbox. here is my .cshtml
AMDI
  • 895
  • 2
  • 17
  • 40
1
vote
1 answer

Facing issue with setting value for dropdown list from Model

I am using MVC with KnockoutJs and facing an issue with a value binding. @Html.DropDownListFor(m => m.PrimarySubspecialty, Model.PrimarySubspecialties, new { id = "ddUserDetailsPrimarySubSpeciality", style = "width:245px;height:25px;", @class =…
AMDI
  • 895
  • 2
  • 17
  • 40
1
vote
0 answers

Failed to load resource: the server responded with a status of 500 (Internal Server Error) - AJAX

I have a controller named CustomersInfoAPIController. I'm using Knock out, webapi2, asp.net mvc5 to build an application. I'm binding the data using knout JS. When I run the application and debug the knockout script, I don't see any error .When I…
1
vote
3 answers

Not able to trigger Knockout data-bind using jQuery

I am writing a plugin using jQuery and knockout. I have two radio buttons. I am using knockout data-bind to check and uncheck the radio button. The problem is that when I am trying to uncheck the radio button on click of another button using jQuery,…