[{"data":1,"prerenderedAt":319},["ShallowReactive",2],{"article-javascript-shorthand-for-getelementbyid":3},{"article":4,"tags":117,"previous":132,"next":210},{"id":5,"title":6,"author":7,"body":8,"createdAt":106,"description":107,"extension":108,"img":107,"meta":109,"navigation":110,"path":111,"seo":112,"stem":113,"tags":114,"updatedAt":106,"__hash__":116},"articles\u002Farticles\u002Fjavascript-shorthand-for-getelementbyid.md","Javascript Shorthand for getElementById","[object Object]",{"type":9,"value":10,"toc":104},"minimark",[11,15,97,100],[12,13,14],"p",{},"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",[16,17,22],"pre",{"className":18,"code":19,"language":20,"meta":21,"style":21},"language-js shiki shiki-themes github-light github-dark","var byId = function( id ) {   \nreturn document.getElementById( id );   \n};  \n  \nbyId( 'someID' )  \n  \n","js","",[23,24,25,55,70,76,82],"code",{"__ignoreMap":21},[26,27,30,34,38,41,44,48,52],"span",{"class":28,"line":29},"line",1,[26,31,33],{"class":32},"szBVR","var",[26,35,37],{"class":36},"sScJk"," byId",[26,39,40],{"class":32}," =",[26,42,43],{"class":32}," function",[26,45,47],{"class":46},"sVt8B","( ",[26,49,51],{"class":50},"s4XuR","id",[26,53,54],{"class":46}," ) {   \n",[26,56,58,61,64,67],{"class":28,"line":57},2,[26,59,60],{"class":32},"return",[26,62,63],{"class":46}," document.",[26,65,66],{"class":36},"getElementById",[26,68,69],{"class":46},"( id );   \n",[26,71,73],{"class":28,"line":72},3,[26,74,75],{"class":46},"};  \n",[26,77,79],{"class":28,"line":78},4,[26,80,81],{"class":46},"  \n",[26,83,85,88,90,94],{"class":28,"line":84},5,[26,86,87],{"class":36},"byId",[26,89,47],{"class":46},[26,91,93],{"class":92},"sZZnC","'someID'",[26,95,96],{"class":46}," )\n",[12,98,99],{},"With jQuery simply $('#{id}) works as well.",[101,102,103],"style",{},"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":21,"searchDepth":57,"depth":57,"links":105},[],"2015-04-20T08:07:13.4100000-04:00",null,"md",{},true,"\u002Farticles\u002Fjavascript-shorthand-for-getelementbyid",{"title":6,"description":107},"articles\u002Fjavascript-shorthand-for-getelementbyid",[115],"javascript","qWKx_-0TTGaDOjOMubmF016hUxs-yFdRnxbL78wcEYQ",[118],{"id":119,"title":120,"body":121,"description":125,"extension":108,"img":126,"meta":127,"name":115,"navigation":110,"path":128,"seo":129,"stem":130,"__hash__":131},"tags\u002Ftags\u002Fjavascript.md","Javascript",{"type":9,"value":122,"toc":123},[],{"title":21,"searchDepth":57,"depth":57,"links":124},[],"JavaScript is a programming language adhering to the ECMAScript spec.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598425237654-4fc758e50a93?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fjavascript",{"description":125},"tags\u002Fjavascript","wqzmOtgcvcAeeB0QinMxw2OqnSglrJN0TeWQ-fulunM",{"id":133,"title":134,"author":7,"body":135,"createdAt":202,"description":107,"extension":108,"img":107,"meta":203,"navigation":110,"path":204,"seo":205,"stem":206,"tags":207,"updatedAt":202,"__hash__":209},"articles\u002Farticles\u002Fdiagnosing-404-errors-on-iis-7-and-asp-net-mvc.md","Diagnosing 404 errors on IIS 7 and ASP.NET MVC",{"type":9,"value":136,"toc":200},[137,167,172,177,182,189,196],[12,138,139,140,144,145,148,149,152,153,155,156,159,160,163,164,166],{},"Are you running in IIS7 ",[141,142,143],"strong",{},"integrated mode","?",[146,147],"br",{},"\nClassic mode of IIS7 does ",[141,150,151],{},"not"," automatically map extensionless URLs to ASP.NET (much like IIS6).",[146,154],{},"\nAlso make sure your ",[23,157,158],{},"Web.config"," ",[23,161,162],{},"\u003Csystem.webServer>"," tag is configured correctly.",[146,165],{},"\ni.e.",[16,168,169],{},[23,170,171],{},"\u003Csystem.webServer>\n    \u003Cvalidation validateIntegratedModeConfiguration=\"false\"\u002F>\n    \u003Cmodules runAllManagedModulesForAllRequests=\"true\"\u002F>\n\u003C\u002Fsystem.webServer>",[16,173,174,176],{},[23,175],{}," ",[16,178,179],{},[23,180,181],{},"On my workstation windows 7, 64 bit I had set my app pool to classic and \nadded a \"Wildcard Script Map\" \nto C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll (32bit dll). \nThe end result was my \nweb.confi webServer section looked like",[16,183,184,186],{},[23,185],{},[23,187,188],{},"  \u003Csystem.webServer>\n    \u003Cvalidation validateIntegratedModeConfiguration=\"false\" \u002F>\n    \u003Cmodules runAllManagedModulesForAllRequests=\"true\" \u002F>\n        \u003Chandlers>\n            \u003Cadd name=\"_wildcard 32\" path=\"*\" verb=\"*\" modules=\"IsapiModule\" \n scriptProcessor=\"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll\" \n resourceType=\"Unspecified\" requireAccess=\"None\" \n preCondition=\"classicMode,runtimeVersionv4.0,bitness32\" \u002F>\n        \u003C\u002Fhandlers>\n  \u003C\u002Fsystem.webServer>\n\n\n",[16,190,192],{"style":191},"font-family: Consolas; background: white; color: black; font-size: 13px;",[26,193,195],{"style":194},"color: blue;","  \n",[16,197,198,176],{},[23,199],{},{"title":21,"searchDepth":57,"depth":57,"links":201},[],"2015-04-20T08:07:13.5000000-04:00",{},"\u002Farticles\u002Fdiagnosing-404-errors-on-iis-7-and-asp-net-mvc",{"title":134,"description":107},"articles\u002Fdiagnosing-404-errors-on-iis-7-and-asp-net-mvc",[208],"aspnet","0t4kM0oaMXwUEwZbS3PO_145nI_leMJKlGcHa5tKNIQ",{"id":211,"title":212,"author":7,"body":213,"createdAt":310,"description":311,"extension":108,"img":226,"meta":312,"navigation":110,"path":313,"seo":314,"stem":315,"tags":316,"updatedAt":317,"__hash__":318},"articles\u002Farticles\u002Fconvert-string-to-enum-c.md","Convert string to Enum c#",{"type":9,"value":214,"toc":308},[215,218,221,227,265,305],[12,216,217],{},"Converting a string to enum is quite easy one, but it needs some attention when converting from string to enum. I will try to explain you how you can convert from a string to enum type.  There is a method IsDefined",[12,219,220],{},"i.e. Enum.IsDefined(typeof(AddressType), type) however this comparison does not incorporate string CASE options hence you may get undesirable results.  It is best to use the CheckStringValueInEnum method below.",[12,222,223],{},[224,225],"img",{"alt":21,"src":226},"\u002Farticles\u002Fimages\u002Fcsharp.png",[16,228,232],{"className":229,"code":230,"language":231,"meta":21,"style":21},"language-csharp shiki shiki-themes github-light github-dark","AddressType addresssType;  \nif (Formatter.CheckStringValueInEnum(type, AddressType)) {  \n    addresssType = (AddressType)Enum.Parse(typeof(AddressType), type, true);  \n} else {  \n    addresssType = AddressType.NA;  \n}  \n","csharp",[23,233,234,239,244,249,254,259],{"__ignoreMap":21},[26,235,236],{"class":28,"line":29},[26,237,238],{},"AddressType addresssType;  \n",[26,240,241],{"class":28,"line":57},[26,242,243],{},"if (Formatter.CheckStringValueInEnum(type, AddressType)) {  \n",[26,245,246],{"class":28,"line":72},[26,247,248],{},"    addresssType = (AddressType)Enum.Parse(typeof(AddressType), type, true);  \n",[26,250,251],{"class":28,"line":78},[26,252,253],{},"} else {  \n",[26,255,256],{"class":28,"line":84},[26,257,258],{},"    addresssType = AddressType.NA;  \n",[26,260,262],{"class":28,"line":261},6,[26,263,264],{},"}\n",[16,266,268],{"className":229,"code":267,"language":231,"meta":21,"style":21},"\u002F\u002Fused to check existence of string in enum  \npublic static bool CheckStringValueInEnum(string stringValue, Enum e) {  \n    foreach (string enumString in Enum.GetNames(e.GetType()))  \n        if (string.Compare(enumString, stringValue, true) == 0)  \n            return true;  \n    return false;  \n}\n",[23,269,270,275,280,285,290,295,300],{"__ignoreMap":21},[26,271,272],{"class":28,"line":29},[26,273,274],{},"\u002F\u002Fused to check existence of string in enum  \n",[26,276,277],{"class":28,"line":57},[26,278,279],{},"public static bool CheckStringValueInEnum(string stringValue, Enum e) {  \n",[26,281,282],{"class":28,"line":72},[26,283,284],{},"    foreach (string enumString in Enum.GetNames(e.GetType()))  \n",[26,286,287],{"class":28,"line":78},[26,288,289],{},"        if (string.Compare(enumString, stringValue, true) == 0)  \n",[26,291,292],{"class":28,"line":84},[26,293,294],{},"            return true;  \n",[26,296,297],{"class":28,"line":261},[26,298,299],{},"    return false;  \n",[26,301,303],{"class":28,"line":302},7,[26,304,264],{},[101,306,307],{},"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":21,"searchDepth":57,"depth":57,"links":309},[],"2015-04-20T08:07:13.3200000-04:00","Converting a string to enum is quite easy one, but it needs some attention when converting from string to enum",{},"\u002Farticles\u002Fconvert-string-to-enum-c",{"title":212,"description":311},"articles\u002Fconvert-string-to-enum-c",[208],"22015-04-20T08:07:13.3200000-04:00","Xe5Wh1yBT7-7lRS-myPAxDtvsAnlNrkctt8CYz72Gbk",1781574764702]