[{"data":1,"prerenderedAt":373},["ShallowReactive",2],{"article-css-lost":3},{"article":4,"tags":138,"previous":153,"next":296},{"id":5,"title":6,"author":7,"body":8,"createdAt":126,"description":127,"extension":128,"img":129,"meta":130,"navigation":131,"path":132,"seo":133,"stem":134,"tags":135,"updatedAt":126,"__hash__":137},"articles\u002Farticles\u002Fcss-lost.md","CSS Lost, Missing, Absent, Gone after Postback in Asp.NET","[object Object]",{"type":9,"value":10,"toc":122},"minimark",[11,15,18,21,28,31,34],[12,13,14],"p",{},"I have a generic function in one of my helper libraries that allows me to open a new browser window when a button is selected.  \nThe button posts back to the server runs some code and opens a new window.  \nI often use this sort of thing on a reporting page allowing me to post some search criteria and open a new window (a pdf report).",[12,16,17],{},"I found this type of helper function useful however I found that I was losing my CSS after the postback.",[12,19,20],{},"To avoid losing the css keep the following in mind:",[22,23,24],"ul",{},[25,26,27],"li",{},"ensure that your css files are included declarative in your aspx page (not through code behind)",[12,29,30],{},"use Page.ClientScript.RegisterStartupScript(this.GetType(),”name”,script); (Not Response.Write)",[12,32,33],{},"The end helper function looks something like the following:",[35,36,38,39,38,55,62,63,38,74,96,97,96,112,96,119,51],"div",{"style":37},"font-size: 9pt; background: white; color: black; font-family: consolas","   \n",[12,40,42,43,48,52],{"style":41},"margin: 0px","    ",[44,45,47],"span",{"style":46},"color: gray","\u002F\u002F\u002F",[44,49,51],{"style":50},"color: green"," ",[44,53,54],{"style":46},"\u003Csummary>",[12,56,42,57,59],{"style":41},[44,58,47],{"style":46},[44,60,61],{"style":50}," redirect to a new page from codebehind","  \n",[12,64,42,65,67,69,72],{"style":41},[44,66,47],{"style":46},[44,68,51],{"style":50},[44,70,71],{"style":46},"\u003C\u002Fsummary>",[44,73,42],{"style":50},[12,75,42,76,51,80,51,83,86,87,90,91,95],{"style":41},[44,77,79],{"style":78},"color: blue","static",[44,81,82],{"style":78},"public",[44,84,85],{"style":78},"void"," RedirectToNewWindow(",[44,88,89],{"style":78},"string"," url, System.Web.UI.",[44,92,94],{"style":93},"color: #2b91af","Page"," page) {        ","    ",[12,98,99,100,102,103,107,108,111],{"style":41},"        ",[44,101,89],{"style":78}," script = ",[44,104,106],{"style":105},"color: #a31515","\"\u003Cscript>window.open('\""," + url + ",[44,109,110],{"style":105},"\"');\u003C\u002Fscript>\"",";",[12,113,114,115,118],{"style":41},"        page.ClientScript.RegisterStartupScript(page.GetType(), ",[44,116,117],{"style":105},"\"redirectscript\"",",script);        ",[12,120,121],{"style":41},"    }",{"title":123,"searchDepth":124,"depth":124,"links":125},"",2,[],"2015-04-20T08:07:17.8100000-04:00","I have a generic function in one of my helper libraries that allows me to open a new browser window when a button is selected.","md",null,{},true,"\u002Farticles\u002Fcss-lost",{"title":6,"description":127},"articles\u002Fcss-lost",[136],"aspnet","b2i1IqyW2Q653DvjckNBJxu4yY2Re8ejfAldTtUJY3I",[139],{"id":140,"title":141,"body":142,"description":146,"extension":128,"img":147,"meta":148,"name":136,"navigation":131,"path":149,"seo":150,"stem":151,"__hash__":152},"tags\u002Ftags\u002Faspnet.md","Aspnet",{"type":9,"value":143,"toc":144},[],{"title":123,"searchDepth":124,"depth":124,"links":145},[],"ASP.NET is an open source web framework, created by Microsoft, for building modern web apps and services with .NET.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Faspnet",{"description":146},"tags\u002Faspnet","SlUGLdZWQy8mYOWC6OetgJkwVulWNURoVHeuESIDleI",{"id":154,"title":155,"author":7,"body":156,"createdAt":289,"description":129,"extension":128,"img":129,"meta":290,"navigation":131,"path":291,"seo":292,"stem":293,"tags":294,"updatedAt":289,"__hash__":295},"articles\u002Farticles\u002Ftesting-web-serviceasmx-remotely-yes-you-can.md","Testing Web Service(ASMX) Remotely (yes, you can!)",{"type":9,"value":157,"toc":287},[158,161],[12,159,160],{},"Often we test web services by either locally on our workstations or remoting to the server and accessing the asmx page. ",[12,162,163,164,282,283],{},"If you try to access the asmx remotely however you are not given the option to test the server (by using the server url address).  By adding the following code the \u003Csystem.web> section of asmx web site web.config you can now test your services remotely.  ",[44,165,169,183,200,215,229,243,261,275],{"className":166,"style":168},[167],"Apple-style-span","word-spacing: 0px; font: 12px\u002F15px verdana; text-transform: none; color: rgb(51,51,51); 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",[170,171,172],"em",{},[173,174,176],"font",{"size":175},3,[173,177,179,180],{"face":178},"Calibri","\u003CwebServices>",[181,182],"br",{},[170,184,185],{},[173,186,187],{"size":175},[173,188,189,197,198],{"face":178},[44,190,191,192],{},"       ",[44,193,196],{"className":194},[195],"Apple-converted-space"," ","\u003Cprotocols>",[181,199],{},[170,201,202],{},[173,203,204],{"size":175},[173,205,206,212,213],{"face":178},[44,207,208,209],{},"           ",[44,210,196],{"className":211},[195],"\u003Cadd name=\"HttpSoap12\"\u002F>",[181,214],{},[170,216,217],{},[173,218,219],{"size":175},[173,220,221,226,227],{"face":178},[44,222,208,223],{},[44,224,196],{"className":225},[195],"\u003Cadd name=\"HttpSoap\"\u002F>",[181,228],{},[170,230,231],{},[173,232,233],{"size":175},[173,234,235,240,241],{"face":178},[44,236,208,237],{},[44,238,196],{"className":239},[195],"\u003Cadd name=\"HttpGet\"\u002F>",[181,242],{},[170,244,245],{},[173,246,247],{"size":175},[173,248,249,255,258,259],{"face":178},[44,250,251,252],{},"         ",[44,253,196],{"className":254},[195],[44,256,257],{},"  ","\u003Cadd name=\"HttpPost\"\u002F>",[181,260],{},[170,262,263],{},[173,264,265],{"size":175},[173,266,267,272,273],{"face":178},[44,268,191,269],{},[44,270,196],{"className":271},[195],"\u003C\u002Fprotocols>",[181,274],{},[170,276,277],{},[173,278,279],{"size":175},[173,280,281],{"face":178},"\u003C\u002FwebServices>","  ",[44,284,286],{"className":285,"style":168},[167],"The above code addresses the issue related to \"The test form is only available for requests from the local machine.\" error message.",{"title":123,"searchDepth":124,"depth":124,"links":288},[],"2015-04-20T08:07:17.9200000-04:00",{},"\u002Farticles\u002Ftesting-web-serviceasmx-remotely-yes-you-can",{"title":155,"description":129},"articles\u002Ftesting-web-serviceasmx-remotely-yes-you-can",[136],"SxKDc8JlqMksiHb_H-HoXeE2EcSX8ZxEqtt1Yn_DRPQ",{"id":297,"title":298,"author":7,"body":299,"createdAt":364,"description":365,"extension":128,"img":360,"meta":366,"navigation":131,"path":367,"seo":368,"stem":369,"tags":370,"updatedAt":364,"__hash__":372},"articles\u002Farticles\u002Fanonymous-objects-or-types-net-3-0.md","Anonymous Objects or Types (.NET 3.0+ )",{"type":9,"value":300,"toc":362},[301,304,324,327,330,333,351,354],[12,302,303],{},"Details...",[22,305,306,309,312,315,318,321],{},[25,307,308],{},"an anonymous type declaration begins with the new keyword followed by a member-initializer list in braces {}",[25,310,311],{},"the compiler generates a new class definition that contains the properties specified in the new member-initializer list",[25,313,314],{},"all properties of an anonymous type are public and immutable  * anonymous type properties are read-only (you cannot modify a properties value once the object is created)",[25,316,317],{},"each property's type is inferred from the values assigned to it",[25,319,320],{},"the compiler defines a ToString method that returns comma-separated list of property-name = value pairs",[25,322,323],{},"Equals method compares the properties of two or more anonymous types",[12,325,326],{},"Examples...  \u002F\u002FCreate a 'person' object using an anonymous type",[12,328,329],{},"var bob = new { Name = \"Bob\", Age = 37 };",[12,331,332],{},"bob in this case is the anonymous type, and the types of the properties are inferred by the value assigned.  \u002F\u002Fdisplay information (note here however that the ToString is not required as a ToString method is automatically defined and is the anonymous type)",[12,334,335,336,338,339,341,342,344,345,347,348,350],{},"Console.WriteLine(\"Bob:\" + bob.ToString());",[181,337],{},"\n\u002F\u002Fthe ToString() method would output the following",[181,340],{},"\nBob: { Name = Bob, Age = 37 }",[181,343],{},"\nvar steve = new { Name = \"Steve\", Age = 36 };",[181,346],{},"\n\u002F\u002Fthe compiler is able to recognize the anonymous type for bob and steve are identical and of the same class by the fact that the properties and types were\nidentical for both bob and steve",[181,349],{},"\n\u002F\u002Fthe anonymous type also creates an equals method that is capable of comparing all objects of this anonymous\ntype (so name and age properties will be compared)",[12,352,353],{},"Console.WriteLine(bob.Equals(steve) ? \"equal\" : \"not equal\"));",[12,355,356,357],{},"The output from the is \"not equal\".",[358,359],"img",{"src":360,"alt":123,"style":361},"\u002Farticles\u002Fimages\u002Fanonymous.jpg","display:none;",{"title":123,"searchDepth":124,"depth":124,"links":363},[],"2015-04-20T08:07:17.7300000-04:00","Anonymous types.",{},"\u002Farticles\u002Fanonymous-objects-or-types-net-3-0",{"title":298,"description":365},"articles\u002Fanonymous-objects-or-types-net-3-0",[371],"NETFeatures","cGVbO2z6ACthfgTvN4W5MWa6AETH2I_6hrC8J6udoNU",1781574761848]