Object-Oriented JavaScriptDynamic ObjectsCreating dynamic object is very similar in c# and JavaScriptBoth c# and JavaScript can add new properties dynamicallyIn JavaScript, we use FUNCTION to define a classwhen using keyword new to initialize a class function, the owner of this function is the newly Read More
posted @ 2012-10-20 00:14 Jian, Li Views(359) Comments(0) Diggs(0)
JavaScript FunctionsNot like c#, less parameter(s) can be passed to a function, the omitted one(s) would be undefinedThere isn’t method overloading like c#, the latter definition simply makes the former one disappear.arguments object can be used within a function to check the parametersUsing the arg Read More
posted @ 2012-10-19 04:51 Jian, Li Views(296) Comments(0) Diggs(0)
JavaScript BasicsSpecial number valuesNote:10/0 doesn’t throw exception, it returns NaN insteadNaN doesn’t equal to NaNuse isNaN function to test NaNisNaN will coalesce string of numberFlow-control statements apply coalescing to booleanIn logical expression, the following values will be treated as f Read More
posted @ 2012-10-19 02:53 Jian, Li Views(228) Comments(0) Diggs(0)
Study (4) Custom Binding Handlers and Persisting DataCustom Binding HandlersDemo: Binding to jQuery button to change multiple attributesHere the binding handler turns the button to jQuery UI button and modifies the attributes of it by conditionRresult:Binding Handler with Behavior - starRating DemoA Read More
posted @ 2012-10-17 04:57 Jian, Li Views(481) Comments(0) Diggs(0)
Study (3) Templates, Control of Flow, and Containerless BindingsNamed Templates in Script TagsEncapsulate a template for re-useDemo:run the code in jsFiddleActually we can use <div> or <ul>, instead of <script> tag to define a template like this:Control of FlowAnonymous-Inline Temp Read More
posted @ 2012-10-13 01:30 Jian, Li Views(305) Comments(0) Diggs(0)
Study (2) Built In BindingsBinding - Text and HTMLTEXT renders the text itself, while HTML renders with html syntax:run the code in jsFiddleBinding - Checkbox and Radio ButtonFor Radio buttons, only if the value attribute equals to the data binding parameter “checked”, KO will set the radio button t Read More
posted @ 2012-10-06 04:36 Jian, Li Views(238) Comments(0) Diggs(0)
只有注册用户登录后才能阅读该文。 Read More
posted @ 2012-10-06 02:56 Jian, Li Views(9) Comments(0) Diggs(0)
Study (1) Bindings and ObservablesUse jQuery to push data to DOM elements, without data bindingUse Knockout’s Observables to bind datadata.jsView Code var my = { }; //my namespacemy.sampleData = (function (my) { "use strict"; var data = { Products: [ { "ModelId": 1, ... Read More
posted @ 2012-10-05 01:41 Jian, Li Views(1007) Comments(0) Diggs(0)
1. Solution StructureAdd Reference to project Contract and Service 2.Code(1)Contracts.ICalculatorusing System.ServiceModel; namespace Leon.WcfServices.Contracts { [ServiceContract(Name = "CalculatorService", Namespace = "http://www.leon.com")] public interface ICalculator { [Oper Read More
posted @ 2012-04-11 03:39 Jian, Li Views(250) Comments(0) Diggs(0)
04 – MVC ModelData Annotationspublic class RegisterModel{ [Required] [Display(Name = "User name")] public string UserName { get; set; } [Required] [DataType(DataType.EmailAddress)] [Display(Name = "Email address")] public string Email { get; set; } [Required] [StringLength... Read More
posted @ 2011-06-16 04:59 Jian, Li Views(691) Comments(0) Diggs(1)