[{"data":1,"prerenderedAt":436},["ShallowReactive",2],{"article-visual-studio-2012-extensions-to-help-you-cope-with-change":3},{"article":4,"tags":61,"previous":76,"next":289},{"id":5,"title":6,"author":7,"body":8,"createdAt":50,"description":47,"extension":51,"img":52,"meta":53,"navigation":54,"path":55,"seo":56,"stem":57,"tags":58,"updatedAt":50,"__hash__":60},"articles\u002Farticles\u002Fvisual-studio-2012-extensions-to-help-you-cope-with-change.md","Visual Studio 2012 Extensions To Help you cope with Change","[object Object]",{"type":9,"value":10,"toc":46},"minimark",[11],[12,13,14,28,37],"ul",{},[15,16,17,23,24,27],"li",{},[18,19,22],"a",{"href":20,"target":21},"http:\u002F\u002Fvisualstudiogallery.msdn.microsoft.com\u002F366ad100-0003-4c9a-81a8-337d4e7ace05","_blank","Visual Studio 2012 Color Theme Editor"," extension! This extension provides you with seven new color themes to choose from as well as the ability to easily create new custom themes.",[25,26],"br",{},"\n ",[15,29,30,34,35,27],{},[18,31,33],{"href":32,"target":21},"http:\u002F\u002Fvisualstudiogallery.msdn.microsoft.com\u002F48dd9c4d-3ba6-4805-9a1f-09099e9af015","All Caps Menu Options","  Allows you to turn all caps in menu titles on and off in the Visual Studio options dialog.",[25,36],{},[15,38,39,43,44,27],{},[18,40,41],{"title":41,"href":42,"target":21},"AttachTo","http:\u002F\u002Fvisualstudiogallery.msdn.microsoft.com\u002Fd0265ab0-df51-4100-8e10-1f84403c4cd0"," Adds \"Attach to IIS\u002FIIS Express\u002FNUnit\" commands to the Tools menu.",[25,45],{},{"title":47,"searchDepth":48,"depth":48,"links":49},"",2,[],"2017-05-29T20:59:15.4218512Z","md",null,{},true,"\u002Farticles\u002Fvisual-studio-2012-extensions-to-help-you-cope-with-change",{"title":6,"description":47},"articles\u002Fvisual-studio-2012-extensions-to-help-you-cope-with-change",[59],"visualstudio","eXEyG5IDOxaAKmdaBzuOQXOkXQO1g5mp6uQo0RU9m-o",[62],{"id":63,"title":64,"body":65,"description":69,"extension":51,"img":70,"meta":71,"name":59,"navigation":54,"path":72,"seo":73,"stem":74,"__hash__":75},"tags\u002Ftags\u002Fvisualstudio.md","Visualstudio",{"type":9,"value":66,"toc":67},[],{"title":47,"searchDepth":48,"depth":48,"links":68},[],"Develop apps for Android, iOS, Mac, Windows, web, and cloud","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fvisualstudio",{"description":69},"tags\u002Fvisualstudio","glm3bYyBlAXGun4NJe-CV_iOzhszydeBRIpbGNNLeEk",{"id":77,"title":78,"author":7,"body":79,"createdAt":280,"description":281,"extension":51,"img":52,"meta":282,"navigation":54,"path":283,"seo":284,"stem":285,"tags":286,"updatedAt":280,"__hash__":288},"articles\u002Farticles\u002Ffeature-exists-activated-on-spsite.md","Feature Exists (Activated on SPSite)",{"type":9,"value":80,"toc":278},[81,85,275],[82,83,84],"p",{},"Method to iterate through SharePoint SPSite collection to check to\nsee if a feature (featureGuid) exists.  If found, method returns true.",[86,87,90,103,111,116,123,128,136,141,148,155,162,167,174,181,188,193,200,205,212,219,226,236,243,249,256,263,270],"pre",{"className":88},[89],"csharpcode",[91,92,94,101],"span",{"style":93},"font-family: Consolas; font-size: x-small;",[91,95,96],{"style":93},[91,97,98],{"style":93},[91,99,100],{"style":93}," ",[91,102,100],{"style":93},[91,104,106],{"style":105},"font-family: Consolas; color: #0000ff; font-size: x-small;",[91,107,108],{"style":105},[91,109,110],{"style":105}," private",[91,112,113],{"style":93},[91,114,115],{"style":93}," ",[91,117,118],{"style":105},[91,119,120],{"style":105},[91,121,122],{"style":105},"bool",[91,124,125],{"style":93},[91,126,127],{"style":93}," FeatureExists(",[91,129,131],{"style":130},"font-family: Consolas; color: #2b91af; font-size: x-small;",[91,132,133],{"style":130},[91,134,135],{"style":130},"SPSite",[91,137,138],{"style":93},[91,139,140],{"style":93}," siteCollection, ",[91,142,143],{"style":130},[91,144,145],{"style":130},[91,146,147],{"style":130},"Guid",[91,149,150,153],{"style":93},[91,151,152],{"style":93}," featureGuid) {",[91,154,100],{"style":93},[91,156,157],{"style":105},[91,158,159],{"style":105},[91,160,161],{"style":105},"    bool",[91,163,164],{"style":93},[91,165,166],{"style":93}," found = ",[91,168,169],{"style":105},[91,170,171],{"style":105},[91,172,173],{"style":105},"false",[91,175,176,179],{"style":93},[91,177,178],{"style":93},";",[91,180,100],{"style":93},[91,182,183],{"style":105},[91,184,185],{"style":105},[91,186,187],{"style":105},"    foreach",[91,189,190],{"style":93},[91,191,192],{"style":93}," (",[91,194,195],{"style":130},[91,196,197],{"style":130},[91,198,199],{"style":130},"SPFeature",[91,201,202],{"style":93},[91,203,204],{"style":93}," feature ",[91,206,207],{"style":105},[91,208,209],{"style":105},[91,210,211],{"style":105},"in",[91,213,214,217],{"style":93},[91,215,216],{"style":93}," siteCollection.Features) {",[91,218,100],{"style":93},[91,220,221],{"style":105},[91,222,223],{"style":105},[91,224,225],{"style":105},"    if",[91,227,228],{"style":93},[91,229,230,231],{"style":93}," (feature.DefinitionId == featureGuid) {\n",[91,232,233],{"style":93},[91,234,235],{"style":93},"      found = ",[91,237,238],{"style":105},[91,239,240],{"style":105},[91,241,242],{"style":105},"true",[91,244,245,247],{"style":93},[91,246,178],{"style":93},[91,248,100],{"style":93},[91,250,251],{"style":105},[91,252,253],{"style":105},[91,254,255],{"style":105},"      break",[91,257,258,261],{"style":93},[91,259,260],{"style":93},";    }  }",[91,262,100],{"style":93},[91,264,265],{"style":105},[91,266,267],{"style":105},[91,268,269],{"style":105}," return",[91,271,272],{"style":93},[91,273,274],{"style":93}," found;} ",[82,276,277],{},"Cool eh?",{"title":47,"searchDepth":48,"depth":48,"links":279},[],"2017-05-29T20:59:15.5333517Z","Iterate through SharePoint SPSite collection",{},"\u002Farticles\u002Ffeature-exists-activated-on-spsite",{"title":78,"description":281},"articles\u002Ffeature-exists-activated-on-spsite",[287],"sharepoint","HNB5xxrT3JuSE5aSwOI_YI0ghRpedBgb1Wc6au43Yp4",{"id":290,"title":291,"author":7,"body":292,"createdAt":425,"description":426,"extension":51,"img":427,"meta":428,"navigation":54,"path":429,"seo":430,"stem":431,"tags":432,"updatedAt":425,"__hash__":435},"articles\u002Farticles\u002Fjquery-mvc-and-textarea-length-validation.md","jQuery \u002F MVC and TextArea Length Validation",{"type":9,"value":293,"toc":423},[294,297,303,306,309,419],[82,295,296],{},"I came across this issue today, and actually surprised I have not had to resolve this problem earlier.",[82,298,299,300,302],{},"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).",[25,301],{},"\nThe resolution was to fix the data server side.",[82,304,305],{},"This was done with a customization\u002Fextension to the DefaultModelBinder, so that all controller actions will benefit immediately.",[82,307,308],{},"You will notice that I trimmed the original input and then replaced \\r\\n with \\n.",[86,310,314],{"className":311,"code":312,"language":313,"meta":47,"style":47},"language-cs shiki shiki-themes github-light github-dark","        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","cs",[315,316,317,324,329,335,341,347,353,359,365,371,377,383,389,395,401,407,413],"code",{"__ignoreMap":47},[91,318,321],{"class":319,"line":320},"line",1,[91,322,323],{},"        protected override void BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)  \n",[91,325,326],{"class":319,"line":48},[91,327,328],{},"        {  \n",[91,330,332],{"class":319,"line":331},3,[91,333,334],{},"            base.BindProperty(controllerContext, bindingContext, propertyDescriptor);  \n",[91,336,338],{"class":319,"line":337},4,[91,339,340],{},"  \n",[91,342,344],{"class":319,"line":343},5,[91,345,346],{},"            \u002F\u002F Note: if desired, one could restrict the conversion to properties decorated with [StringLength]:  \n",[91,348,350],{"class":319,"line":349},6,[91,351,352],{},"            \u002F\u002F &amp;&amp; propertyDescriptor.Attributes.OfType().Any()  \n",[91,354,356],{"class":319,"line":355},7,[91,357,358],{},"            if (propertyDescriptor.PropertyType == typeof(string))  \n",[91,360,362],{"class":319,"line":361},8,[91,363,364],{},"            {  \n",[91,366,368],{"class":319,"line":367},9,[91,369,370],{},"                var originalString = propertyDescriptor.GetValue(bindingContext.Model) as string;  \n",[91,372,374],{"class":319,"line":373},10,[91,375,376],{},"                if (!string.IsNullOrEmpty(originalString))  \n",[91,378,380],{"class":319,"line":379},11,[91,381,382],{},"                {  \n",[91,384,386],{"class":319,"line":385},12,[91,387,388],{},"                    originalString = originalString.Trim();  \n",[91,390,392],{"class":319,"line":391},13,[91,393,394],{},"                    var stringWithNormalizedNewlines = originalString.Replace(\"\\r\\n\", \"\\n\");  \n",[91,396,398],{"class":319,"line":397},14,[91,399,400],{},"                    propertyDescriptor.SetValue(bindingContext.Model, stringWithNormalizedNewlines);  \n",[91,402,404],{"class":319,"line":403},15,[91,405,406],{},"                }  \n",[91,408,410],{"class":319,"line":409},16,[91,411,412],{},"            }  \n",[91,414,416],{"class":319,"line":415},17,[91,417,418],{},"        }\n",[420,421,422],"style",{},"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":47,"searchDepth":48,"depth":48,"links":424},[],"2017-05-29T20:59:15.3883517Z","Surprised about a jQuery issue.","\u002Farticles\u002Fimages\u002Fc1zuUO5OvF.png",{},"\u002Farticles\u002Fjquery-mvc-and-textarea-length-validation",{"title":291,"description":426},"articles\u002Fjquery-mvc-and-textarea-length-validation",[433,434],"javascript","aspnet","A1TBFqd_HmSDNRRkH9XShYU1vUr45yBIdO-DMLgubPI",1781574769660]