[{"data":1,"prerenderedAt":1890},["ShallowReactive",2],{"tag-javascript":3},{"tag":4,"articles":24},{"id":5,"title":6,"body":7,"description":14,"extension":15,"img":16,"meta":17,"name":18,"navigation":19,"path":20,"seo":21,"stem":22,"__hash__":23},"tags\u002Ftags\u002Fjavascript.md","Javascript",{"type":8,"value":9,"toc":10},"minimark",[],{"title":11,"searchDepth":12,"depth":12,"links":13},"",2,[],"JavaScript is a programming language adhering to the ECMAScript spec.","md","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598425237654-4fc758e50a93?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"javascript",true,"\u002Ftags\u002Fjavascript",{"description":14},"tags\u002Fjavascript","wqzmOtgcvcAeeB0QinMxw2OqnSglrJN0TeWQ-fulunM",[25,308,535,659,719,1036,1583,1636,1709,1795,1848],{"id":26,"title":27,"author":28,"body":29,"createdAt":297,"description":298,"extension":15,"img":299,"meta":300,"navigation":19,"path":301,"seo":302,"stem":303,"tags":304,"updatedAt":297,"__hash__":307},"articles\u002Farticles\u002Fstarting-jquery-and-get-the-downloads-and-patchesfor-visual-studio-net-2008.md","Starting jQuery and Get the downloads and patches(for Visual Studio.NET 2008)","[object Object]",{"type":8,"value":30,"toc":295},[31,46,54,291],[32,33,34,35,41,42,45],"p",{},"1.) Download install VS.NET 2008 SP1 patch   Visual Studio 2008 SP1 has the following patch to allow IntelliSense with jQuery found\n",[36,37,40],"a",{"href":38,"target":39},"http:\u002F\u002Fcode.msdn.microsoft.com\u002FKB958502\u002FRelease\u002FProjectReleases.aspx?ReleaseId=1736","_blank","here",".  Note: this is a patch that is applied\nafter .NET 3.5 SP1 and Visual Studio 2008 SP1.  Information about this patch can be found\n",[36,43,40],{"href":44,"target":39},"http:\u002F\u002Fblogs.msdn.com\u002Fwebdevtools\u002Farchive\u002F2008\u002F11\u002F07\u002Fhotfix-to-enable-vsdoc-js-intellisense-doc-files-is-now-available.aspx",".\nI did find that the vsdoc.js version must match the version of jquery in order for the intellisense to function correctly.  If the versions mismatch intellisense\nwill not work.",[32,47,48,49,53],{},"2.) ",[36,50,52],{"href":51,"target":39},"http:\u002F\u002Fdocs.jquery.com\u002FDownloading_jQuery","Download"," jQuery documentation library  ",[55,56,57,67,73,76,214,220,285,288],"blockquote",{},[32,58,59,60,62,63],{},"3.) ",[36,61,52],{"href":51,"target":39}," jQuery \n",[64,65],"img",{"alt":11,"src":66},"\u002Farticles\u002Fimages\u002FAsp.netCompilationModels_86E6\u002Fimage_4a.png",[32,68,69,70],{},"4.) Copy both 2 and 3 to your solution Scripts folder\n",[64,71],{"alt":11,"src":72},"\u002Farticles\u002Fimages\u002FAsp.netCompilationModels_86E6\u002Fimage_8.png",[32,74,75],{},"5.) In your aspx reference the jquery file",[77,78,82],"pre",{"className":79,"code":80,"language":81,"meta":11,"style":11},"language-js shiki shiki-themes github-light github-dark","\u003Cscript src=\"Scripts\u002Fjquery-1.2.6.min.js\" type=\"text\u002Fjavascript\">\u003C\u002Fscript>    or    \u003Casp:ScriptManager runat=\"server\" ID=\"scriptmanager1\">     \n    \u003CScripts>      \n        \u003Casp:ScriptReference Path=\"~\u002FScripts\u002Fjquery-1.2.6.min\" \u002F>      \n    \u003C\u002FScripts>      \n\u003C\u002Fasp:ScriptManager> \n","js",[83,84,85,154,165,190,200],"code",{"__ignoreMap":11},[86,87,90,94,98,102,106,110,113,115,118,121,123,126,128,131,134,136,139,143,145,148,151],"span",{"class":88,"line":89},"line",1,[86,91,93],{"class":92},"sVt8B","\u003C",[86,95,97],{"class":96},"s9eBZ","script",[86,99,101],{"class":100},"sScJk"," src",[86,103,105],{"class":104},"szBVR","=",[86,107,109],{"class":108},"sZZnC","\"Scripts\u002Fjquery-1.2.6.min.js\"",[86,111,112],{"class":100}," type",[86,114,105],{"class":104},[86,116,117],{"class":108},"\"text\u002Fjavascript\"",[86,119,120],{"class":92},">\u003C\u002F",[86,122,97],{"class":96},[86,124,125],{"class":92},">    or    ",[86,127,93],{"class":104},[86,129,130],{"class":100},"asp",[86,132,133],{"class":92},":ScriptManager runat",[86,135,105],{"class":104},[86,137,138],{"class":108},"\"server\"",[86,140,142],{"class":141},"sj4cs"," ID",[86,144,105],{"class":104},[86,146,147],{"class":108},"\"scriptmanager1\"",[86,149,150],{"class":104},">",[86,152,153],{"class":92},"     \n",[86,155,156,159,162],{"class":88,"line":12},[86,157,158],{"class":92},"    \u003C",[86,160,161],{"class":141},"Scripts",[86,163,164],{"class":92},">      \n",[86,166,168,171,173,176,179,182,184,187],{"class":88,"line":167},3,[86,169,170],{"class":92},"        \u003C",[86,172,130],{"class":96},[86,174,175],{"class":92},":",[86,177,178],{"class":141},"ScriptReference",[86,180,181],{"class":100}," Path",[86,183,105],{"class":104},[86,185,186],{"class":108},"\"~\u002FScripts\u002Fjquery-1.2.6.min\"",[86,188,189],{"class":92}," \u002F>      \n",[86,191,193,196,198],{"class":88,"line":192},4,[86,194,195],{"class":92},"    \u003C\u002F",[86,197,161],{"class":141},[86,199,164],{"class":92},[86,201,203,206,208,211],{"class":88,"line":202},5,[86,204,205],{"class":104},"\u003C\u002F",[86,207,130],{"class":100},[86,209,210],{"class":92},":ScriptManager",[86,212,213],{"class":104},">\n",[32,215,216],{},[217,218,219],"strong",{},"Some Quick Tips",[221,222,223,227,240,246,259,265,271],"ul",{},[224,225,226],"li",{},"If you are using a master page the script reference only needs to exist in the master page",[224,228,229,230,233,234,236,237,239],{},"javascript intellisense will not work in user controls by default as\nthe user control doesn’t have a reference to the js file.  A work around (use the following at the top of the user control).  At runtime ASP.NET will\nnot render this tag however Visual Studio will evaluate the script and provide intellisense",[231,232],"br",{},"\n\u003C% if (false) { %>",[231,235],{},"\n      \u003Cscript src=”..\u002FScripts\u002Fjquery-1.2.6.min.js” type=”text\u002Fjavascript”>",[231,238],{},"\n\u003C% } %>",[224,241,242,243,245],{},"a recommended method of including js files is to create one js file which entail will include references to any number of specific js files, then on your web page\ninclude a reference to this one single js file",[231,244],{},"\n\u003Creference path=”~\u002FScripts\u002Fjquery-1.2.6.min.js” \u002F>",[224,247,248,249,251,254,255,258],{},"a good approach is to remove the version number from the jquery files to allow easier updates to these files in the future",[231,250],{},[217,252,253],{},"Path(s) for Script References","     * ",[217,256,257],{},"File-Relative Paths"," i.e. ..\u002F..\u002Ffile.js This type of path\nis relative to the currently loaded file.  Support - ASP.NET Web forms \u002F MVC",[224,260,261,264],{},[217,262,263],{},"App-Relative Paths"," i.e. ~\u002Ffolder\u002Ffile.js  Is calculated\nfrom the base of your application.  ASP.NET Web forms supports this type of path however\nthe path must be within a scriptreference tag or select asp.net\ncontrols which have runat=”server”",[224,266,267,270],{},[217,268,269],{},"Site-Relative Paths"," i.e. \u002Ffolder\u002Ffile.js  Is calculated from the base of your site.  Supported\nby ASP.NET Web forms \u002F MVC however is not supported by Visual Studio",[224,272,273,276,277,280,284],{},[217,274,275],{},"Absolute Paths"," i.e. ",[36,278],{"href":279},"http:\u002F\u002Fsite\u002Ffolder\u002Ffile.js",[36,281,279],{"href":279,"rel":282},[283],"nofollow"," \nSupported by ASP.NET Web forms \u002F MVC and Visual Studio   If using Visual Studio(ASP.NET Web forms) recommended to use App-Relative paths ~\u002Ffolder\u002Ffile.js. ",[32,286,287],{},"If using MVC use file-relative paths.",[64,289],{"src":290,"alt":11},"\u002Farticles\u002Fimages\u002Fjquery.jpg",[292,293,294],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s9eBZ, html code.shiki .s9eBZ{--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":296},[],"2020-06-11T20:28:49.852Z",null,"\u002Farticles\u002Fimages\u002Fimage_thumb.png",{},"\u002Farticles\u002Fstarting-jquery-and-get-the-downloads-and-patchesfor-visual-studio-net-2008",{"title":27,"description":298},"articles\u002Fstarting-jquery-and-get-the-downloads-and-patchesfor-visual-studio-net-2008",[305,18,306],"aspnet","visualstudio","CaoqzxSPqdjjJIKDlApGzP7mizluXjytJfH68p7chaE",{"id":309,"title":310,"author":298,"body":311,"createdAt":526,"description":315,"extension":15,"img":527,"meta":528,"navigation":19,"path":529,"seo":530,"stem":531,"tags":532,"updatedAt":526,"__hash__":534},"articles\u002Farticles\u002Fwindowscryptographicexception-the-system-cannot-find-the-file-specified.md","WindowsCryptographicException The system cannot find the file specified.",{"type":8,"value":312,"toc":524},[313,316,319,341,344,358,521],[32,314,315],{},"Azure – while trying to read pfx (certificate) from disk I came across a number of issues, but thought this might help some out.",[32,317,318],{},"The fix was adding the final parameter X509KeyStorageFlags",[77,320,324],{"className":321,"code":322,"language":323,"meta":11,"style":11},"language-cs shiki shiki-themes github-light github-dark","var cert = new X509Certificate2(\n    $\"{Environment.ContentRootPath}\u002FApp_Data\u002Fmycert.pfx\",\"{password}\",\n    X509KeyStorageFlags.MachineKeySet); \n","cs",[83,325,326,331,336],{"__ignoreMap":11},[86,327,328],{"class":88,"line":89},[86,329,330],{},"var cert = new X509Certificate2(\n",[86,332,333],{"class":88,"line":12},[86,334,335],{},"    $\"{Environment.ContentRootPath}\u002FApp_Data\u002Fmycert.pfx\",\"{password}\",\n",[86,337,338],{"class":88,"line":167},[86,339,340],{},"    X509KeyStorageFlags.MachineKeySet);\n",[32,342,343],{},"Other references:",[32,345,346,349,352,355],{},[36,347],{"href":348},"https:\u002F\u002Fsupport.microsoft.com\u002Fen-us\u002Fhelp\u002F950090\u002Finstalling-a-pfx-file-using-x509certificate-from-a-standard-net-applic",[36,350,348],{"href":348,"rel":351},[283],[36,353],{"href":354},"https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F52750160\u002Fwhat-is-the-rationale-for-all-the-different-x509keystorageflags",[36,356,354],{"href":354,"rel":357},[283],[77,359,363],{"className":360,"code":361,"language":362,"meta":11,"style":11},"language-html shiki shiki-themes github-light github-dark","An unhandled exception occurred while processing the request.\nWindowsCryptographicException: The system cannot find the file specified. System.Security.Cryptography.CngKey.Open(string keyName, CngProvider provider, CngKeyOpenOptions openOptions)  \nException: An error was encountered while handling the remote login. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler\u003CTOptions>.HandleRequestAsync()  \nStack Query Cookies Headers Routing \nWindowsCryptographicException: The system cannot find the file specified. System.Security.Cryptography.CngKey.Open(string keyName, \n    CngProvider provider, CngKeyOpenOptions openOptions) \nSystem.Security.Cryptography.CngKey.Open(string keyName, CngProvider provider) \nInternal.Cryptography.Pal.CertificatePal.GetPrivateKey\u003CT>(Func\u003CCspParameters, T> createCsp, Func\u003CCngKey, T> createCng) \nInternal.Cryptography.Pal.CertificatePal.GetRSAPrivateKey() \nSystem.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey() \nMicrosoft.IdentityModel.Tokens.X509SecurityKey.get_PrivateKey() \nMicrosoft.IdentityModel.Tokens.X509SecurityKey.get_PrivateKeyStatus() \nMicrosoft.IdentityModel.Tokens.AsymmetricSignatureProvider.FoundPrivateKey(SecurityKey key) \nMicrosoft.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor(SecurityKey key, string algorithm, bool willCreateSignatures) \nMicrosoft.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor(SecurityKey key, string algorithm, bool willCreateSignatures, \n        CryptoProviderFactory cryptoProviderFactory) \nMicrosoft.IdentityModel.Tokens.CryptoProviderFactory.CreateSignatureProvider(SecurityKey key, string algorithm, bool willCreateSignatures) \nMicrosoft.IdentityModel.Tokens.CryptoProviderFactory.CreateForSigning(SecurityKey key, string algorithm)  Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities.CreateEncodedSignature(string input, SigningCredentials signingCredentials) System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.WriteToken(SecurityToken token)  Sample.Idp.Startup+\u003C>c__DisplayClass7_0.\u003CConfigureServices>b__8(AuthorizationCodeReceivedContext context) in Startup.cs\nMicrosoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectEvents.AuthorizationCodeReceived(AuthorizationCodeReceivedContext context) Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.RunAuthorizationCodeReceivedEventAsync(OpenIdConnectMessage authorizationResponse, ClaimsPrincipal user, AuthenticationProperties properties, JwtSecurityToken jwt) \nMicrosoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync() \n","html",[83,364,365,370,375,387,392,397,403,409,438,444,450,456,462,468,474,480,486,492,509,515],{"__ignoreMap":11},[86,366,367],{"class":88,"line":89},[86,368,369],{"class":92},"An unhandled exception occurred while processing the request.\n",[86,371,372],{"class":88,"line":12},[86,373,374],{"class":92},"WindowsCryptographicException: The system cannot find the file specified. System.Security.Cryptography.CngKey.Open(string keyName, CngProvider provider, CngKeyOpenOptions openOptions)  \n",[86,376,377,380,384],{"class":88,"line":167},[86,378,379],{"class":92},"Exception: An error was encountered while handling the remote login. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler\u003C",[86,381,383],{"class":382},"s7hpK","TOptions",[86,385,386],{"class":92},">.HandleRequestAsync()  \n",[86,388,389],{"class":88,"line":192},[86,390,391],{"class":92},"Stack Query Cookies Headers Routing \n",[86,393,394],{"class":88,"line":202},[86,395,396],{"class":92},"WindowsCryptographicException: The system cannot find the file specified. System.Security.Cryptography.CngKey.Open(string keyName, \n",[86,398,400],{"class":88,"line":399},6,[86,401,402],{"class":92},"    CngProvider provider, CngKeyOpenOptions openOptions) \n",[86,404,406],{"class":88,"line":405},7,[86,407,408],{"class":92},"System.Security.Cryptography.CngKey.Open(string keyName, CngProvider provider) \n",[86,410,412,415,418,421,424,427,430,433,435],{"class":88,"line":411},8,[86,413,414],{"class":92},"Internal.Cryptography.Pal.CertificatePal.GetPrivateKey\u003C",[86,416,417],{"class":382},"T",[86,419,420],{"class":92},">(Func\u003C",[86,422,423],{"class":382},"CspParameters,",[86,425,426],{"class":100}," T",[86,428,429],{"class":92},"> createCsp, Func\u003C",[86,431,432],{"class":382},"CngKey,",[86,434,426],{"class":100},[86,436,437],{"class":92},"> createCng) \n",[86,439,441],{"class":88,"line":440},9,[86,442,443],{"class":92},"Internal.Cryptography.Pal.CertificatePal.GetRSAPrivateKey() \n",[86,445,447],{"class":88,"line":446},10,[86,448,449],{"class":92},"System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey() \n",[86,451,453],{"class":88,"line":452},11,[86,454,455],{"class":92},"Microsoft.IdentityModel.Tokens.X509SecurityKey.get_PrivateKey() \n",[86,457,459],{"class":88,"line":458},12,[86,460,461],{"class":92},"Microsoft.IdentityModel.Tokens.X509SecurityKey.get_PrivateKeyStatus() \n",[86,463,465],{"class":88,"line":464},13,[86,466,467],{"class":92},"Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.FoundPrivateKey(SecurityKey key) \n",[86,469,471],{"class":88,"line":470},14,[86,472,473],{"class":92},"Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor(SecurityKey key, string algorithm, bool willCreateSignatures) \n",[86,475,477],{"class":88,"line":476},15,[86,478,479],{"class":92},"Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor(SecurityKey key, string algorithm, bool willCreateSignatures, \n",[86,481,483],{"class":88,"line":482},16,[86,484,485],{"class":92},"        CryptoProviderFactory cryptoProviderFactory) \n",[86,487,489],{"class":88,"line":488},17,[86,490,491],{"class":92},"Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateSignatureProvider(SecurityKey key, string algorithm, bool willCreateSignatures) \n",[86,493,495,498,500,503,506],{"class":88,"line":494},18,[86,496,497],{"class":92},"Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateForSigning(SecurityKey key, string algorithm)  Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities.CreateEncodedSignature(string input, SigningCredentials signingCredentials) System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.WriteToken(SecurityToken token)  Sample.Idp.Startup+",[86,499,93],{"class":382},[86,501,502],{"class":92},">c__DisplayClass7_0.\u003C",[86,504,505],{"class":382},"ConfigureServices",[86,507,508],{"class":92},">b__8(AuthorizationCodeReceivedContext context) in Startup.cs\n",[86,510,512],{"class":88,"line":511},19,[86,513,514],{"class":92},"Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectEvents.AuthorizationCodeReceived(AuthorizationCodeReceivedContext context) Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.RunAuthorizationCodeReceivedEventAsync(OpenIdConnectMessage authorizationResponse, ClaimsPrincipal user, AuthenticationProperties properties, JwtSecurityToken jwt) \n",[86,516,518],{"class":88,"line":517},20,[86,519,520],{"class":92},"Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()\n",[292,522,523],{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s7hpK, html code.shiki .s7hpK{--shiki-default:#B31D28;--shiki-default-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}",{"title":11,"searchDepth":12,"depth":12,"links":525},[],"2020-05-08T18:24:50.164Z","\u002Farticles\u002Fimages\u002Fimage_thumb_637245590899400228.png",{},"\u002Farticles\u002Fwindowscryptographicexception-the-system-cannot-find-the-file-specified",{"title":310,"description":315},"articles\u002Fwindowscryptographicexception-the-system-cannot-find-the-file-specified",[533,18],"azure","gbbOXSewTUn-I9zN11i80mm77-02qjY2Sj3AUb7gbjM",{"id":536,"title":537,"author":28,"body":538,"createdAt":650,"description":651,"extension":15,"img":652,"meta":653,"navigation":19,"path":654,"seo":655,"stem":656,"tags":657,"updatedAt":650,"__hash__":658},"articles\u002Farticles\u002Fjquery-mvc-and-textarea-length-validation.md","jQuery \u002F MVC and TextArea Length Validation",{"type":8,"value":539,"toc":648},[540,543,549,552,555,645],[32,541,542],{},"I came across this issue today, and actually surprised I have not had to resolve this problem earlier.",[32,544,545,546,548],{},"When validating a textarea on the client side with jQuery unobtrusive validation (for length) you have to be conscientious about how JavaScript deals with carriage return\u002Fline feed characters in comparison to the posted values to your controller.  For example on the client JavaScript sees CR\u002FLF as \\n while after posted to the server that same CR\u002FLF will be represented by \\r\\n.  If you are validating the user entered data for length your counts will be different depending on the environment (i.e. model will pass validation on the client but fail on the server).",[231,547],{},"\nThe resolution was to fix the data server side.",[32,550,551],{},"This was done with a customization\u002Fextension to the DefaultModelBinder, so that all controller actions will benefit immediately.",[32,553,554],{},"You will notice that I trimmed the original input and then replaced \\r\\n with \\n.",[77,556,558],{"className":321,"code":557,"language":323,"meta":11,"style":11},"        protected override void BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)  \n        {  \n            base.BindProperty(controllerContext, bindingContext, propertyDescriptor);  \n  \n            \u002F\u002F Note: if desired, one could restrict the conversion to properties decorated with [StringLength]:  \n            \u002F\u002F &amp;&amp; propertyDescriptor.Attributes.OfType().Any()  \n            if (propertyDescriptor.PropertyType == typeof(string))  \n            {  \n                var originalString = propertyDescriptor.GetValue(bindingContext.Model) as string;  \n                if (!string.IsNullOrEmpty(originalString))  \n                {  \n                    originalString = originalString.Trim();  \n                    var stringWithNormalizedNewlines = originalString.Replace(\"\\r\\n\", \"\\n\");  \n                    propertyDescriptor.SetValue(bindingContext.Model, stringWithNormalizedNewlines);  \n                }  \n            }  \n        }\n",[83,559,560,565,570,575,580,585,590,595,600,605,610,615,620,625,630,635,640],{"__ignoreMap":11},[86,561,562],{"class":88,"line":89},[86,563,564],{},"        protected override void BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)  \n",[86,566,567],{"class":88,"line":12},[86,568,569],{},"        {  \n",[86,571,572],{"class":88,"line":167},[86,573,574],{},"            base.BindProperty(controllerContext, bindingContext, propertyDescriptor);  \n",[86,576,577],{"class":88,"line":192},[86,578,579],{},"  \n",[86,581,582],{"class":88,"line":202},[86,583,584],{},"            \u002F\u002F Note: if desired, one could restrict the conversion to properties decorated with [StringLength]:  \n",[86,586,587],{"class":88,"line":399},[86,588,589],{},"            \u002F\u002F &amp;&amp; propertyDescriptor.Attributes.OfType().Any()  \n",[86,591,592],{"class":88,"line":405},[86,593,594],{},"            if (propertyDescriptor.PropertyType == typeof(string))  \n",[86,596,597],{"class":88,"line":411},[86,598,599],{},"            {  \n",[86,601,602],{"class":88,"line":440},[86,603,604],{},"                var originalString = propertyDescriptor.GetValue(bindingContext.Model) as string;  \n",[86,606,607],{"class":88,"line":446},[86,608,609],{},"                if (!string.IsNullOrEmpty(originalString))  \n",[86,611,612],{"class":88,"line":452},[86,613,614],{},"                {  \n",[86,616,617],{"class":88,"line":458},[86,618,619],{},"                    originalString = originalString.Trim();  \n",[86,621,622],{"class":88,"line":464},[86,623,624],{},"                    var stringWithNormalizedNewlines = originalString.Replace(\"\\r\\n\", \"\\n\");  \n",[86,626,627],{"class":88,"line":470},[86,628,629],{},"                    propertyDescriptor.SetValue(bindingContext.Model, stringWithNormalizedNewlines);  \n",[86,631,632],{"class":88,"line":476},[86,633,634],{},"                }  \n",[86,636,637],{"class":88,"line":482},[86,638,639],{},"            }  \n",[86,641,642],{"class":88,"line":488},[86,643,644],{},"        }\n",[292,646,647],{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":649},[],"2017-05-29T20:59:15.3883517Z","Surprised about a jQuery issue.","\u002Farticles\u002Fimages\u002Fc1zuUO5OvF.png",{},"\u002Farticles\u002Fjquery-mvc-and-textarea-length-validation",{"title":537,"description":651},"articles\u002Fjquery-mvc-and-textarea-length-validation",[18,305],"A1TBFqd_HmSDNRRkH9XShYU1vUr45yBIdO-DMLgubPI",{"id":660,"title":661,"author":28,"body":662,"createdAt":710,"description":711,"extension":15,"img":712,"meta":713,"navigation":19,"path":714,"seo":715,"stem":716,"tags":717,"updatedAt":710,"__hash__":718},"articles\u002Farticles\u002F75-really-useful-javascript-techniques-more.md","75 (Really) Useful JavaScript Techniques +More",{"type":8,"value":663,"toc":708},[664,667,675,681,687,693,699,705],[32,665,666],{},"A really nice collection of JavaScript tools and scripts can be found here",[32,668,669,672],{},[36,670],{"title":671,"href":671},"http:\u002F\u002Fwww.smashingmagazine.com\u002F2008\u002F09\u002F11\u002F75-really-useful-javascript-techniques\u002F",[36,673,671],{"href":671,"rel":674},[283],[32,676,677],{},[36,678,680],{"href":679},"http:\u002F\u002Fwww.smashingmagazine.com\u002F2007\u002F06\u002F20\u002Fajax-javascript-solutions-for-professional-coding\u002F","80+ AJAX-Solutions For Professional Coding",[32,682,683],{},[36,684,686],{"href":685},"http:\u002F\u002Fwww.smashingmagazine.com\u002F2008\u002F04\u002F15\u002F60-more-ajax-and-javascript-solutions-for-professional-coding\u002F","60 More AJAX- and Javascript Solutions For Professional Coding",[32,688,689],{},[36,690,692],{"href":691},"http:\u002F\u002Fwww.smashingmagazine.com\u002F2007\u002F05\u002F18\u002F30-best-solutions-for-image-galleries-slideshows-lightboxes\u002F","30 Scripts For Galleries, Slideshows and Lightboxes",[32,694,695],{},[36,696,698],{"href":697},"http:\u002F\u002Fwww.smashingmagazine.com\u002F2007\u002F06\u002F12\u002Ftooltips-scripts-ajax-javascript-css-dhtml\u002F","40+ Tooltips Scripts With AJAX, JavaScript & CSS",[32,700,701],{},[36,702,704],{"href":703},"http:\u002F\u002Fwww.smashingmagazine.com\u002F2007\u002F05\u002F30\u002Ftables-and-data-grids-with-ajax-dhtml-javascript\u002F","Data Grids with AJAX, DHTML and JavaScript",[32,706,707],{},"All these resources are very good and certainly something here for everyone.",{"title":11,"searchDepth":12,"depth":12,"links":709},[],"2015-04-20T08:07:19.0000000-04:00","A really nice collection of JavaScript tools and scripts can be found here.","\u002Farticles\u002Fimages\u002F28QUDU0HYd.png",{},"\u002Farticles\u002F75-really-useful-javascript-techniques-more",{"title":661,"description":711},"articles\u002F75-really-useful-javascript-techniques-more",[18],"0sO-yyldLtzjQCHlwmXdN-AiCLoCZv1PxMvU0AsKUkM",{"id":720,"title":721,"author":28,"body":722,"createdAt":1027,"description":1028,"extension":15,"img":1029,"meta":1030,"navigation":19,"path":1031,"seo":1032,"stem":1033,"tags":1034,"updatedAt":1027,"__hash__":1035},"articles\u002Farticles\u002Fasp-net-ajax-client-library-global-shortcut-list.md","ASP.NET AJAX Client Library Global Shortcut List",{"type":8,"value":723,"toc":1025},[724,732,735,738,749,760,769,808,817,859,868],[32,725,726],{},[86,727,731],{"className":728,"style":730},[729],"Apple-style-span","word-spacing: 0px; font: 13px arial; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; text-align: left; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0","Recently, Microsoft released their ASP.NET AJAX Framework which allows developers to build AJAX applications more easily.  ASP.NET AJAX consists of two pieces. ",[32,733,734],{},"1.) Microsoft AJAX Library - contains a set of script files that provide common functions and an OO programming framework",[32,736,737],{},"2.) ASP.NET 2.0 AJAX Extensions - includes a set of server controls that allows developers to add AJAX functionality by dragging and dropping controls onto a page",[32,739,740,741,748],{},"The following are brief descriptions of the javascript extensions made available by the AJAX Client Library by Namespace.  ",[86,742,744,747],{"className":743,"style":730},[729],[217,745,746],{},"Global Namespace"," - contains members and types that extend base JavaScript objects.","  ",[55,750,751,752,759],{},"   ",[86,753,755,758],{"className":754,"style":730},[729],[217,756,757],{},"Array Extensions"," (add, addRange, clear, clone, contains, dequeue, enqueue, forEach, indexOf, insert, pars, remove, removeAt)"," ",[55,761,751,762,759],{},[86,763,765,768],{"className":764,"style":730},[729],[217,766,767],{},"Boolean ","Extension (parse - converts a string into a Boolean)",[55,770,751,771],{},[86,772,774,777,778,780,781,783,784],{"className":773,"style":730},[729],[217,775,776],{},"Date ","Extension (format, localeFormat, parseInvariant, parseLocale)",[231,779],{},"\nvar today = new Date();",[231,782],{},"\nalert (today.format('D'));",[32,785,786,787,789,790,792,793,795,796,798,799,801,802,804,805,807],{},"d - Short date pattern (05\u002F10\u002F07)",[231,788],{},"\nD - Long date pattern (Thursday, 10 May 2007)",[231,791],{},"\nt - Short time pattern (18:05)",[231,794],{},"\nT - Long time pattern (18:05:12)",[231,797],{},"\nF- Full date pattern (Thursday, 10 May 2007 18:05:12)",[231,800],{},"\nM - Month and date pattern (May 10)",[231,803],{},"\ns - Sortable date and time pattern (2007-05-10T18:05:12)",[231,806],{},"\nY - Year and month pattern (2007 May) ",[55,809,751,810,759],{},[86,811,813,816],{"className":812,"style":730},[729],[217,814,815],{},"Error Extensions"," (argument, argumentNull, argumentOutOfRange, argumentType, argumentUndefined, create, invalidOperation, notImplemented, parameterCount, popStackFrame)",[55,818,751,819,826,827],{},[86,820,822,825],{"className":821,"style":730},[729],[217,823,824],{},"Number Extension"," (format, localeFormat, parseInvariant, parseLocale)","    ",[86,828,830,831,833,834,836,837,839,840],{"className":829,"style":730},[729],"        p - number is converted to a string that represents a percent",[231,832],{},"\nd - converted to a string of decimal digits",[231,835],{},"\nc - converted to a string that represents a currency",[231,838],{},"\nn - converted to a string of the form \"-d,ddd,dd\"",[32,841,842,843,845,846,759],{},"var num = Number.parseInvariant(\"130.33\");",[231,844],{},"\nalert (num.localeFormat(\"c\")); \u002F\u002F $130.33    ",[86,847,849,852,853,855,856,858],{"className":848,"style":730},[729],[217,850,851],{},"Object Extensions"," (getType, getTypeName)",[231,854],{},"\ngetType - returns the type of specified object",[231,857],{},"\ngetTypeName - returns the type name of an object",[55,860,751,861,759],{},[86,862,864,867],{"className":863,"style":730},[729],[217,865,866],{},"String Extension"," (endsWith, format, localeFormat, startsWith, trim, trimEnd, trimStart)",[86,869,871,877,911,929,930],{"className":870,"style":730},[729],[217,872,873,759],{},[36,874,876],{"href":875,"target":39},"http:\u002F\u002Fmsdn.microsoft.com\u002Fen-us\u002Flibrary\u002Fbb397536.aspx","Sys Namespace",[32,878,879,880,882,883,885,886,888,889,891,892,894,895,897,898,900,901,903,904,906,907],{},"Sys - root namespace containing some base classes such as Sys.CultureInfo",[231,881],{},"\nApplication - objects\u002Fmethods that expose client events and manage client components",[231,884],{},"\nApplicationLoadEventArgs - container object for arguments of the Application Load event",[231,887],{},"\nCancelEventArgs - base class for events that can be canceled",[231,890],{},"\nComponent - base class for all asp.net ajax objects including Control class and Behavior class",[231,893],{},"\nCultureInfo - object that can be used to provide locale specific functionality",[231,896],{},"\nDebug code - debugging and tracing functionality",[231,899],{},"\nEventArgs - used for storing event arguments",[231,902],{},"\nEventHandlerList - collection of client events for a component containing event names and handlers\nPropertyChangedEventArgs - contains event arguments associated with changed properties",[231,905],{},"\nStringBuilder - facilitates more efficient ",[36,908,910],{"href":909,"target":39},"http:\u002F\u002Fmsdn.microsoft.com\u002Fen-us\u002Flibrary\u002Fbb310852.aspx","string concatenation",[32,912,913,914,916,917,919,920,922,923,925,926,928],{},"Sys.Net - provides networking and communication support",[231,915],{},"\nSys.UI - contains set of classes for UI support",[231,918],{},"\nSys.Services - support for asp.net application services such as login\u002Fauthentication",[231,921],{},"\nSys.Serialization - provides support for data serialization\u002FJson",[231,924],{},"\nSys.WebForms - contains classes for async page loading",[231,927],{},"\n  ","                                                                                                                                                                                                                                                                      ",[931,932,936],"table",{"cellSpacing":933,"cellPadding":933,"width":934,"border":935},"0",748,0,[937,938,939,956,964,972,980,988,996,1004,1012,1019],"tbody",{},[940,941,942,950],"tr",{},[943,944,947],"td",{"vAlign":945,"width":946},"top",145,[217,948,949],{},"Shortcut",[943,951,953],{"vAlign":945,"width":952},601,[217,954,955],{},"Description",[940,957,958,961],{},[943,959,960],{"vAlign":945,"width":946},"$addHandler",[943,962,963],{"vAlign":945,"width":952},"Shortcut to Sys.UI.DomEvent.addHandler method",[940,965,966,969],{},[943,967,968],{"vAlign":945,"width":946},"$addHandlers",[943,970,971],{"vAlign":945,"width":952},"Shortcut to Sys.UI.DomEvent.addHandlers method ",[940,973,974,977],{},[943,975,976],{"vAlign":945,"width":946},"$clearHandlers",[943,978,979],{"vAlign":945,"width":952},"Shortcut to Sys.UI.DomEvent.clearHandlers method",[940,981,982,985],{},[943,983,984],{"vAlign":945,"width":946},"$create",[943,986,987],{"vAlign":945,"width":952},"Shortcut to Sys.Component.create method",[940,989,990,993],{},[943,991,992],{"vAlign":945,"width":946},"$find",[943,994,995],{"vAlign":945,"width":952},"Shortcut to Sys.Application.findComponent method",[940,997,998,1001],{},[943,999,1000],{"vAlign":945,"width":946},"$get",[943,1002,1003],{"vAlign":945,"width":952},"Shortcut to Sys.UI.DomElement.getElementId method",[940,1005,1006,1009],{},[943,1007,1008],{"vAlign":945,"width":946},"$removeHandler",[943,1010,1011],{"vAlign":945,"width":952},"Shortcut to System.UI.DomEvent.removeHandler method",[940,1013,1014,1017],{},[943,1015,1016],{"vAlign":945,"width":946}," ",[943,1018,1016],{"vAlign":945,"width":952},[940,1020,1021,1023],{},[943,1022,1016],{"vAlign":945,"width":946},[943,1024,1016],{"vAlign":945,"width":952},{"title":11,"searchDepth":12,"depth":12,"links":1026},[],"2015-04-20T08:07:16.9200000-04:00","The following are brief descriptions of the javascript extensions made available by the AJAX Client Library by Namespace","\u002Farticles\u002Fimages\u002FfB5BBkL2by.png",{},"\u002Farticles\u002Fasp-net-ajax-client-library-global-shortcut-list",{"title":721,"description":1028},"articles\u002Fasp-net-ajax-client-library-global-shortcut-list",[18],"WhenAc5IArfx2XOO9yOgZabko6SX3dvPL2yA13Q5O50",{"id":1037,"title":1038,"author":28,"body":1039,"createdAt":1027,"description":298,"extension":15,"img":1575,"meta":1576,"navigation":19,"path":1577,"seo":1578,"stem":1579,"tags":1580,"updatedAt":1027,"__hash__":1582},"articles\u002Farticles\u002Fselect2-and-knockout-binding.md","Select2 and Knockout Binding",{"type":8,"value":1040,"toc":1573},[1041,1058,1303,1310,1570],[32,1042,1043,1044,1048,1049,1051,1052,1054,1055,1057],{},"If using ",[36,1045,1047],{"href":1046},"http:\u002F\u002Fivaynberg.github.io\u002Fselect2\u002F","Select2 ","and Knockout, you have the following options for hooking up to html elements. In both of these cases my viewmodel has a property called EvaluatorList with collection object properties of DisplayName and Code.",[231,1050],{},"\n ",[231,1053],{},"\n1.) Manual",[231,1056],{},"\nJavaScript looking like",[77,1059,1062],{"className":1060,"code":1061,"language":18,"meta":11,"style":11},"language-javascript shiki shiki-themes github-light github-dark","        $(\"#txtEvaluator\").select2({  \n            placeholder: 'Evaluator',  \n            multiple:true,  \n            allowClear: true,  \n            id: function (e) { return e.Code },  \n            data: { results: ko.toJS(viewModel.EvaluatorList()), text: 'DisplayName' },  \n            formatSelection: function (item) { return item.DisplayName; },  \n            formatResult: function (item) { return item.DisplayName; }  \n        }).on(\"select2-selecting\", function (e) {  \n            $('#txtEvaluatorId').val(e.val).change();  \n        }).on(\"select2-removed\", function (e) {  \n            $('#txtEvaluatorId').val('').change();  \n        });  \n",[83,1063,1064,1084,1095,1105,1114,1141,1164,1185,1205,1230,1254,1275,1298],{"__ignoreMap":11},[86,1065,1066,1069,1072,1075,1078,1081],{"class":88,"line":89},[86,1067,1068],{"class":100},"        $",[86,1070,1071],{"class":92},"(",[86,1073,1074],{"class":108},"\"#txtEvaluator\"",[86,1076,1077],{"class":92},").",[86,1079,1080],{"class":100},"select2",[86,1082,1083],{"class":92},"({  \n",[86,1085,1086,1089,1092],{"class":88,"line":12},[86,1087,1088],{"class":92},"            placeholder: ",[86,1090,1091],{"class":108},"'Evaluator'",[86,1093,1094],{"class":92},",  \n",[86,1096,1097,1100,1103],{"class":88,"line":167},[86,1098,1099],{"class":92},"            multiple:",[86,1101,1102],{"class":141},"true",[86,1104,1094],{"class":92},[86,1106,1107,1110,1112],{"class":88,"line":192},[86,1108,1109],{"class":92},"            allowClear: ",[86,1111,1102],{"class":141},[86,1113,1094],{"class":92},[86,1115,1116,1119,1122,1125,1128,1132,1135,1138],{"class":88,"line":202},[86,1117,1118],{"class":100},"            id",[86,1120,1121],{"class":92},": ",[86,1123,1124],{"class":104},"function",[86,1126,1127],{"class":92}," (",[86,1129,1131],{"class":1130},"s4XuR","e",[86,1133,1134],{"class":92},") { ",[86,1136,1137],{"class":104},"return",[86,1139,1140],{"class":92}," e.Code },  \n",[86,1142,1143,1146,1149,1152,1155,1158,1161],{"class":88,"line":399},[86,1144,1145],{"class":92},"            data: { results: ko.",[86,1147,1148],{"class":100},"toJS",[86,1150,1151],{"class":92},"(viewModel.",[86,1153,1154],{"class":100},"EvaluatorList",[86,1156,1157],{"class":92},"()), text: ",[86,1159,1160],{"class":108},"'DisplayName'",[86,1162,1163],{"class":92}," },  \n",[86,1165,1166,1169,1171,1173,1175,1178,1180,1182],{"class":88,"line":405},[86,1167,1168],{"class":100},"            formatSelection",[86,1170,1121],{"class":92},[86,1172,1124],{"class":104},[86,1174,1127],{"class":92},[86,1176,1177],{"class":1130},"item",[86,1179,1134],{"class":92},[86,1181,1137],{"class":104},[86,1183,1184],{"class":92}," item.DisplayName; },  \n",[86,1186,1187,1190,1192,1194,1196,1198,1200,1202],{"class":88,"line":411},[86,1188,1189],{"class":100},"            formatResult",[86,1191,1121],{"class":92},[86,1193,1124],{"class":104},[86,1195,1127],{"class":92},[86,1197,1177],{"class":1130},[86,1199,1134],{"class":92},[86,1201,1137],{"class":104},[86,1203,1204],{"class":92}," item.DisplayName; }  \n",[86,1206,1207,1210,1213,1215,1218,1221,1223,1225,1227],{"class":88,"line":440},[86,1208,1209],{"class":92},"        }).",[86,1211,1212],{"class":100},"on",[86,1214,1071],{"class":92},[86,1216,1217],{"class":108},"\"select2-selecting\"",[86,1219,1220],{"class":92},", ",[86,1222,1124],{"class":104},[86,1224,1127],{"class":92},[86,1226,1131],{"class":1130},[86,1228,1229],{"class":92},") {  \n",[86,1231,1232,1235,1237,1240,1242,1245,1248,1251],{"class":88,"line":446},[86,1233,1234],{"class":100},"            $",[86,1236,1071],{"class":92},[86,1238,1239],{"class":108},"'#txtEvaluatorId'",[86,1241,1077],{"class":92},[86,1243,1244],{"class":100},"val",[86,1246,1247],{"class":92},"(e.val).",[86,1249,1250],{"class":100},"change",[86,1252,1253],{"class":92},"();  \n",[86,1255,1256,1258,1260,1262,1265,1267,1269,1271,1273],{"class":88,"line":452},[86,1257,1209],{"class":92},[86,1259,1212],{"class":100},[86,1261,1071],{"class":92},[86,1263,1264],{"class":108},"\"select2-removed\"",[86,1266,1220],{"class":92},[86,1268,1124],{"class":104},[86,1270,1127],{"class":92},[86,1272,1131],{"class":1130},[86,1274,1229],{"class":92},[86,1276,1277,1279,1281,1283,1285,1287,1289,1292,1294,1296],{"class":88,"line":458},[86,1278,1234],{"class":100},[86,1280,1071],{"class":92},[86,1282,1239],{"class":108},[86,1284,1077],{"class":92},[86,1286,1244],{"class":100},[86,1288,1071],{"class":92},[86,1290,1291],{"class":108},"''",[86,1293,1077],{"class":92},[86,1295,1250],{"class":100},[86,1297,1253],{"class":92},[86,1299,1300],{"class":88,"line":464},[86,1301,1302],{"class":92},"        });\n",[32,1304,1305,1306],{},"Option 2) Using ",[36,1307,1309],{"href":1308},"\u002Fblog\u002Fpost\u002F2014\u002F01\u002F20\u002FSelect2-and-Knockout-Binding.aspx","binding handler",[77,1311,1313],{"className":1060,"code":1312,"language":18,"meta":11,"style":11},"ko.bindingHandlers.select2 = {  \n    init: function (element, valueAccessor, allBindingsAccessor) {  \n        var obj = valueAccessor(),  \n            allBindings = allBindingsAccessor(),  \n            lookupKey = allBindings.lookupKey;  \n        $(element).select2(obj);  \n        if (lookupKey) {  \n            var value = ko.utils.unwrapObservable(allBindings.value);  \n            $(element).select2('data', ko.utils.arrayFirst(obj.data.results, function (item) {  \n                return item[lookupKey] === value;  \n            }));  \n        }  \n  \n        ko.utils.domNodeDisposal.addDisposeCallback(element, function () {  \n            $(element).select2('destroy');  \n        });  \n    },  \n    update: function (element) {  \n        $(element).trigger('change');  \n    }  \n};  \n",[83,1314,1315,1325,1351,1367,1379,1389,1401,1409,1428,1458,1472,1477,1482,1486,1502,1518,1523,1528,1543,1559,1564],{"__ignoreMap":11},[86,1316,1317,1320,1322],{"class":88,"line":89},[86,1318,1319],{"class":92},"ko.bindingHandlers.select2 ",[86,1321,105],{"class":104},[86,1323,1324],{"class":92}," {  \n",[86,1326,1327,1330,1332,1334,1336,1339,1341,1344,1346,1349],{"class":88,"line":12},[86,1328,1329],{"class":100},"    init",[86,1331,1121],{"class":92},[86,1333,1124],{"class":104},[86,1335,1127],{"class":92},[86,1337,1338],{"class":1130},"element",[86,1340,1220],{"class":92},[86,1342,1343],{"class":1130},"valueAccessor",[86,1345,1220],{"class":92},[86,1347,1348],{"class":1130},"allBindingsAccessor",[86,1350,1229],{"class":92},[86,1352,1353,1356,1359,1361,1364],{"class":88,"line":167},[86,1354,1355],{"class":104},"        var",[86,1357,1358],{"class":92}," obj ",[86,1360,105],{"class":104},[86,1362,1363],{"class":100}," valueAccessor",[86,1365,1366],{"class":92},"(),  \n",[86,1368,1369,1372,1374,1377],{"class":88,"line":192},[86,1370,1371],{"class":92},"            allBindings ",[86,1373,105],{"class":104},[86,1375,1376],{"class":100}," allBindingsAccessor",[86,1378,1366],{"class":92},[86,1380,1381,1384,1386],{"class":88,"line":202},[86,1382,1383],{"class":92},"            lookupKey ",[86,1385,105],{"class":104},[86,1387,1388],{"class":92}," allBindings.lookupKey;  \n",[86,1390,1391,1393,1396,1398],{"class":88,"line":399},[86,1392,1068],{"class":100},[86,1394,1395],{"class":92},"(element).",[86,1397,1080],{"class":100},[86,1399,1400],{"class":92},"(obj);  \n",[86,1402,1403,1406],{"class":88,"line":405},[86,1404,1405],{"class":104},"        if",[86,1407,1408],{"class":92}," (lookupKey) {  \n",[86,1410,1411,1414,1417,1419,1422,1425],{"class":88,"line":411},[86,1412,1413],{"class":104},"            var",[86,1415,1416],{"class":92}," value ",[86,1418,105],{"class":104},[86,1420,1421],{"class":92}," ko.utils.",[86,1423,1424],{"class":100},"unwrapObservable",[86,1426,1427],{"class":92},"(allBindings.value);  \n",[86,1429,1430,1432,1434,1436,1438,1441,1444,1447,1450,1452,1454,1456],{"class":88,"line":440},[86,1431,1234],{"class":100},[86,1433,1395],{"class":92},[86,1435,1080],{"class":100},[86,1437,1071],{"class":92},[86,1439,1440],{"class":108},"'data'",[86,1442,1443],{"class":92},", ko.utils.",[86,1445,1446],{"class":100},"arrayFirst",[86,1448,1449],{"class":92},"(obj.data.results, ",[86,1451,1124],{"class":104},[86,1453,1127],{"class":92},[86,1455,1177],{"class":1130},[86,1457,1229],{"class":92},[86,1459,1460,1463,1466,1469],{"class":88,"line":446},[86,1461,1462],{"class":104},"                return",[86,1464,1465],{"class":92}," item[lookupKey] ",[86,1467,1468],{"class":104},"===",[86,1470,1471],{"class":92}," value;  \n",[86,1473,1474],{"class":88,"line":452},[86,1475,1476],{"class":92},"            }));  \n",[86,1478,1479],{"class":88,"line":458},[86,1480,1481],{"class":92},"        }  \n",[86,1483,1484],{"class":88,"line":464},[86,1485,579],{"class":92},[86,1487,1488,1491,1494,1497,1499],{"class":88,"line":470},[86,1489,1490],{"class":92},"        ko.utils.domNodeDisposal.",[86,1492,1493],{"class":100},"addDisposeCallback",[86,1495,1496],{"class":92},"(element, ",[86,1498,1124],{"class":104},[86,1500,1501],{"class":92}," () {  \n",[86,1503,1504,1506,1508,1510,1512,1515],{"class":88,"line":476},[86,1505,1234],{"class":100},[86,1507,1395],{"class":92},[86,1509,1080],{"class":100},[86,1511,1071],{"class":92},[86,1513,1514],{"class":108},"'destroy'",[86,1516,1517],{"class":92},");  \n",[86,1519,1520],{"class":88,"line":482},[86,1521,1522],{"class":92},"        });  \n",[86,1524,1525],{"class":88,"line":488},[86,1526,1527],{"class":92},"    },  \n",[86,1529,1530,1533,1535,1537,1539,1541],{"class":88,"line":494},[86,1531,1532],{"class":100},"    update",[86,1534,1121],{"class":92},[86,1536,1124],{"class":104},[86,1538,1127],{"class":92},[86,1540,1338],{"class":1130},[86,1542,1229],{"class":92},[86,1544,1545,1547,1549,1552,1554,1557],{"class":88,"line":511},[86,1546,1068],{"class":100},[86,1548,1395],{"class":92},[86,1550,1551],{"class":100},"trigger",[86,1553,1071],{"class":92},[86,1555,1556],{"class":108},"'change'",[86,1558,1517],{"class":92},[86,1560,1561],{"class":88,"line":517},[86,1562,1563],{"class":92},"    }  \n",[86,1565,1567],{"class":88,"line":1566},21,[86,1568,1569],{"class":92},"};\n",[292,1571,1572],{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":1574},[],"\u002Farticles\u002Fimages\u002Fko.jpg",{},"\u002Farticles\u002Fselect2-and-knockout-binding",{"title":1038,"description":298},"articles\u002Fselect2-and-knockout-binding",[305,362,18,1581],"knockout","IAV-2N-X-tExH1G5PlY5R0oGGOGSG-lUgmlyANRbjsM",{"id":1584,"title":1585,"author":28,"body":1586,"createdAt":1628,"description":1629,"extension":15,"img":1624,"meta":1630,"navigation":19,"path":1631,"seo":1632,"stem":1633,"tags":1634,"updatedAt":1628,"__hash__":1635},"articles\u002Farticles\u002Fnamespace-your-javascript.md","Namespace your JavaScript",{"type":8,"value":1587,"toc":1626},[1588,1596,1599,1602,1605,1622],[32,1589,1590,1591,1051,1593,1595],{},"There are a couple of ways to create namespaces for your code.  This format allows you to intentionally expose functions as public or keep them internal\u002Fprivate.  I like the following version…",[231,1592],{},[231,1594],{},"\nvar mynamespace = new function () {",[55,1597,1598],{},"  \nvar internalFunction = function() { \n     \u002F\u002FTODO: code \n};  \n",[55,1600,1601],{},"  \nthis.publicFunction = function() { \n    \u002F\u002FTODO: code \n};  \n",[217,1603,1604],{},"Simple, now why the heck do this?",[221,1606,1607,1610,1613,1616,1619],{},[224,1608,1609],{},"A namespace is a container and allows you to bundle up all your functionality using a unique name",[224,1611,1612],{},"In JavaScript a namespace is really just an object that you have attached all further methods, properties and objects",[224,1614,1615],{},"Without the usage of namespaces every function will be in the global (aka window) namespace (this occurs by default if you do not use a namespace).  It is a good practice not to clutter the global namespace",[224,1617,1618],{},"Using namespaces prevents the overwriting of existing function names",[224,1620,1621],{},"Using namespaces is one step in the direction of object-oriented which promotes modularity and code re-use",[64,1623],{"src":1624,"alt":11,"style":1625},"\u002Farticles\u002Fimages\u002Fns.png","display:none;",{"title":11,"searchDepth":12,"depth":12,"links":1627},[],"2015-04-20T08:07:13.6900000-04:00","How to use namespaces within your JavaScript",{},"\u002Farticles\u002Fnamespace-your-javascript",{"title":1585,"description":1629},"articles\u002Fnamespace-your-javascript",[18],"hpUwRZUyAy5HzKNcCB4a57Dnyk7v34btaAKN8B18S4o",{"id":1637,"title":1638,"author":28,"body":1639,"createdAt":1701,"description":1702,"extension":15,"img":1696,"meta":1703,"navigation":19,"path":1704,"seo":1705,"stem":1706,"tags":1707,"updatedAt":1701,"__hash__":1708},"articles\u002Farticles\u002Fjson-know-more.md","Json–know more",{"type":8,"value":1640,"toc":1697},[1641,1658,1663,1667,1672,1675,1679,1682,1694],[32,1642,1643,1644,1646,1649,1650,1652,1653,1655,1657],{},"{“People”:{",[231,1645],{},[86,1647,1648],{},"\n{“name”:”frank”, “age”:”21”},\n{“name”:”joe”,”age”:44”}\n",",",[231,1651],{},"\n“Markeing”:",[86,1654,1648],{},[231,1656],{},"\n} }",[1659,1660,1662],"h4",{"id":1661},"squiggles-squares-colons-and-commas","Squiggles, Squares, Colons and Commas",[1664,1665,1666],"ol",{},"  \n* Squiggly brackets act as 'containers'   \n* Square brackets holds arrays   \n* Names and values are separated by a colon.   \n* Array elements are separated by commas  \n",[1668,1669,1671],"h3",{"id":1670},"json-is-like-xml-because","\nJSON is like XML because:",[1664,1673,1674],{},"  \n* They are both 'self-describing' meaning that values are named, and thus 'human readable'   \n* Both are hierarchical. (i.e. You can have values within values.)   \n* Both can be parsed and used by lots of programming languages   \n* Both can be passed around using AJAX (i.e. httpWebRequest)  \n",[1668,1676,1678],{"id":1677},"json-is-unlike-xml-because","JSON is UNlike XML because:",[1664,1680,1681],{},"  \n* XML uses angle brackets, with a tag name at the start and end of an element: JSON uses squiggly brackets with the name only at the beginning of the element.   \n* JSON is less verbose so it's definitely quicker for humans to write, and probably quicker for us to read.   \n* JSON can be parsed trivially using the eval() procedure in JavaScript   \n* JSON includes arrays {where each element doesn't have a name of its own}   \n* In XML you can use any name you want for an element, in JSON you can't use reserved words from javascript  \n",[32,1683,1684,1685,1688,1689,1693],{},"On the server-side you can easily serialize\u002Fdeserialize your objects to\u002Ffrom JSON. For ",[83,1686,1687],{},".net"," programmers you can use libraries like ",[36,1690,1692],{"href":1691},"http:\u002F\u002Fwww.newtonsoft.com\u002Fproducts\u002Fjson\u002F","Json.net"," to do this automatically for you (using reflection i assume), or you can generate your own custom code to perform it even faster on a case by case basis.",[64,1695],{"src":1696,"alt":11,"style":1625},"\u002Farticles\u002Fimages\u002FJSON.gif",{"title":11,"searchDepth":12,"depth":12,"links":1698},[1699,1700],{"id":1670,"depth":167,"text":1671},{"id":1677,"depth":167,"text":1678},"2015-04-20T08:07:13.6000000-04:00","{“People”:{\n{“name”:”frank”, “age”:”21”},\n{“name”:”joe”,”age”:44”}\n,\n“Markeing”:\n{“name”:”frank”, “age”:”21”},\n{“name”:”joe”,”age”:44”}\n\n} }",{},"\u002Farticles\u002Fjson-know-more",{"title":1638,"description":1702},"articles\u002Fjson-know-more",[305,18],"OoXmULq_Ve1WX5OVc1z-FhmnTNctKTJ7RjuIMoBl31Q",{"id":1710,"title":1711,"author":28,"body":1712,"createdAt":1788,"description":298,"extension":15,"img":298,"meta":1789,"navigation":19,"path":1790,"seo":1791,"stem":1792,"tags":1793,"updatedAt":1788,"__hash__":1794},"articles\u002Farticles\u002Fjavascript-shorthand-for-getelementbyid.md","Javascript Shorthand for getElementById",{"type":8,"value":1713,"toc":1786},[1714,1717,1780,1783],[32,1715,1716],{},"In the following sample I define a variable byId and set it to the function. You can use any valid variable name in place of byId",[77,1718,1720],{"className":79,"code":1719,"language":81,"meta":11,"style":11},"var byId = function( id ) {   \nreturn document.getElementById( id );   \n};  \n  \nbyId( 'someID' )  \n  \n",[83,1721,1722,1745,1758,1763,1767],{"__ignoreMap":11},[86,1723,1724,1727,1730,1733,1736,1739,1742],{"class":88,"line":89},[86,1725,1726],{"class":104},"var",[86,1728,1729],{"class":100}," byId",[86,1731,1732],{"class":104}," =",[86,1734,1735],{"class":104}," function",[86,1737,1738],{"class":92},"( ",[86,1740,1741],{"class":1130},"id",[86,1743,1744],{"class":92}," ) {   \n",[86,1746,1747,1749,1752,1755],{"class":88,"line":12},[86,1748,1137],{"class":104},[86,1750,1751],{"class":92}," document.",[86,1753,1754],{"class":100},"getElementById",[86,1756,1757],{"class":92},"( id );   \n",[86,1759,1760],{"class":88,"line":167},[86,1761,1762],{"class":92},"};  \n",[86,1764,1765],{"class":88,"line":192},[86,1766,579],{"class":92},[86,1768,1769,1772,1774,1777],{"class":88,"line":202},[86,1770,1771],{"class":100},"byId",[86,1773,1738],{"class":92},[86,1775,1776],{"class":108},"'someID'",[86,1778,1779],{"class":92}," )\n",[32,1781,1782],{},"With jQuery simply $('#{id}) works as well.",[292,1784,1785],{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":1787},[],"2015-04-20T08:07:13.4100000-04:00",{},"\u002Farticles\u002Fjavascript-shorthand-for-getelementbyid",{"title":1711,"description":298},"articles\u002Fjavascript-shorthand-for-getelementbyid",[18],"qWKx_-0TTGaDOjOMubmF016hUxs-yFdRnxbL78wcEYQ",{"id":1796,"title":1797,"author":28,"body":1798,"createdAt":1840,"description":1841,"extension":15,"img":298,"meta":1842,"navigation":19,"path":1843,"seo":1844,"stem":1845,"tags":1846,"updatedAt":1840,"__hash__":1847},"articles\u002Farticles\u002Fusing-jsrender-with-javascript-and-html.md","Using JsRender with JavaScript and HTML",{"type":8,"value":1799,"toc":1838},[1800,1806,1812,1815,1822,1826],[32,1801,1802,1803,1805],{},"JsRender is a JavaScript library that allows you to define a boilerplate structure once and reuse it to generate HTML dynamically. JsRender brings a new templating library to HTML5 development that has a codeless tag syntax and high performance, has no dependency on jQuery nor on the Document Object Model (DOM), supports creating custom functions and uses pure string-based rendering.",[231,1804],{},"\nThe following sample will utilize a method within a MVC controller to output json string via jquery ajax call.",[77,1807,1811],{"className":1808},[1809,1810],"brush:","csharp","        public JsonResult GetCustomers()  \n        {  \n            var customers = new List(){  \n                new Customer() { ID= \"1\", Name= \"Bobby Jones\", Birthday= \"1902-03-17\" },  \n                new Customer() { ID= \"2\", Name= \"Sam Snead\",   Birthday= \"1912-05-27\" },  \n                new Customer() { ID= \"3\", Name= \"Tiger Woods\", Birthday= \"1975-12-30\" }  \n            };             \n            return this.Json(customers, JsonRequestBehavior.AllowGet);  \n            }  \n        }  \n  \n    public class Customer{  \n        public string ID {get; set;}  \n        public string Name {get; set;}  \n        public string Birthday {get; set;}  \n    }  \n    ",[32,1813,1814],{},"You can render templates using JavaScript in several ways. First you’ll want to define your template either as a string or in a \u003Cscript> tag. The \u003Cscript> tag option is nice when you want to define your templates in the HTML, give them an id and reuse them. You can also create templates from strings, which gives you the ability to create them on the fly in code or even pull them from a data store..  The JavaScript on the page is as follows",[77,1816,579,1818,579],{"className":1817},[1809,18],[97,1819,1821],{"type":1820},"text\u002Fjavascript","\u002F\u002F \u003C![CDATA[  \n         function getdata() {  \n        var s = $.getJSON(\"\u002FHome\u002FGetCustomers\", function (data) {  \n             $(\"#GolferDiv\").html($(\"#InnerGolferTemplate1\").render(data));  \n        });           \n        }  \n\u002F\u002F ]]>",[1823,1824,1016],"div",{"id":1825},"GolferDiv",[77,1827,1829,579,1834,579],{"className":1828},[1809,362],[1830,1831],"input",{"type":1832,"value":1833},"button","get data",[97,1835,1837],{"id":1836,"type":1820},"InnerGolferTemplate1","\u002F\u002F \u003C![CDATA[  \n         {{:ID}}: \u003Cb>{{:Name}}\u003C\u002Fb> \u003Ci>{{:Birthday}}\u003C\u002Fi> \u003Cbr \u002F>  \n\u002F\u002F ]]>",{"title":11,"searchDepth":12,"depth":12,"links":1839},[],"2015-04-20T08:07:12.7600000-04:00","JsRender is a JavaScript library that allows you to define a boilerplate structure once and reuse it to generate HTML dynamically.",{},"\u002Farticles\u002Fusing-jsrender-with-javascript-and-html",{"title":1797,"description":1841},"articles\u002Fusing-jsrender-with-javascript-and-html",[18],"X9dre_jVgpJBCollFTxNxhq1RoM7KALI3HKpYTjYECA",{"id":1849,"title":1850,"author":28,"body":1851,"createdAt":1882,"description":1883,"extension":15,"img":298,"meta":1884,"navigation":19,"path":1885,"seo":1886,"stem":1887,"tags":1888,"updatedAt":1882,"__hash__":1889},"articles\u002Farticles\u002Fjavascript-patterns-self-invocation.md","JavaScript Patterns Self invocation",{"type":8,"value":1852,"toc":1880},[1853,1859,1863,1866,1870,1873,1877],[32,1854,1855,1856,1858],{},"Self-invocation (also known as auto-invocation) is when a function executes immediately upon it's definition. ",[231,1857],{},"\nThis is a core pattern and serves as the foundation for many other patterns of JavaScript development.  A self-invoking function is a standard function, just with a set of parentheses appended to the end.",[77,1860,1862],{"className":1861},[1809,18],"     \nfunction(){  \n    var msg = \"hello\";  \n    alert(msg);  \n}();  \n",[32,1864,1865],{},"The above example defines an anonymous function. This creates a literal function, yet since no name is attributed to it, the value is never stored. The trailing parenthesis tell the function to execute, just as if you were calling a named function. Once the function terminates, the variables are discarded and the global object remains unchanged. It it recommended that an extra set of parentheses wrap the function definition as well so to provide a visual clue to the developer that the function isn’t a normal function.",[77,1867,1869],{"className":1868},[1809,18],"     \n(function(){  \n    var msg = \"hello\";  \n    alert(msg);  \n})();  \n  \n",[32,1871,1872],{},"In the event where a self-invoking function requires parameters, they can be passed in the same manor that you would a regular function",[77,1874,1876],{"className":1875},[1809,18],"     \n(function(id){  \n    var msg = \"hello\";  \n    alert(msg);  \n})('idvalue');  \n  \n",[32,1878,1879],{},"In an effort to protect the global object, all JavaScript applications should be written within a self-invoking function. This will create an application scope in which variables can be created without the fear of them colliding with other applications. If a global variable is needed, developers must take the extra step by setting them directly within the window object. For example window.foo = ‘bar’;. Self-invocation is a fundamental pattern of professional JavaScript development.",{"title":11,"searchDepth":12,"depth":12,"links":1881},[],"2015-04-20T08:07:12.0000000-04:00","Learn about self invocation javascript patterns.",{},"\u002Farticles\u002Fjavascript-patterns-self-invocation",{"title":1850,"description":1883},"articles\u002Fjavascript-patterns-self-invocation",[18],"6mEuLpLXzvMN8rDuNWbgVGP4TND1riFnYdYRKLW0aeI",1781574759545]