Wednesday 15 September 2010

razor - How to use knockout js binding in asp.net mv4 web application -


Hi guys, I'm trying to use a project which adheres to 3-level architecture, which uses mvc 4 in my web application. Knockout is binding, but although my data is retrieved from my data level, UI has not been updated. Below is my code snippet

My model which resides in my data level, which is a separate class library

  Public Ink SocialProfileId {get; Set; } Public string title {get; Set; } Public string description {get; Set; } Public String Url {get; Set; } Public string ImgUrl {get; Set; }   

SocialViewModel = function in my web project var {var self = this;

  self.Title = ko.observable (""); Self.SocialLinks = ko.observableArray (); GetSocialLinks (); GetSocialLinks function ($ {$. Ajax ({Type: "GET", url: "Ville / SocialLnk", Content Type: "App / Jason; Charset = UTF-8", Datatype: "Jason", Success: Function (Data) {Self.SocialLinks ); Warning (data [0]);}, error: function (error) {warning (ART + + "<-> and ->" + erro.statusText);}}); }}   

My view is showing my binding

  

No comments:

Post a Comment