Monthly Archives: September 2007

Force a named pipes connection

To force a named pipes connection to your database, prepend the name in your connection string with “np:”. E.g.

Posted in C#, MS SQL Server | Leave a comment

Override appSettings with the file attribute

To help make applications a bit more portable, it is nice to know you can override the appSettings group in your app.config or web.config file in the following manner:         The, in the same directory, create a file userAppSettings.config, … Continue reading

Posted in C# | Leave a comment

Intellisense for MSBuild files

To “enable” Intellisense for MSBuild projects ending with the extension “msbuild”: 1)      1) Add this registry key (no line break in the key): [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Editors\ {412B8852-4F21-413B-9B47-0C9751D3EBFB}\Extensions]”msbuild”=dword:00000029 2)      Create a file called “test.msbuild” and then try to open it.  Choose “Select program … Continue reading

Posted in MSBuild, Visual Studio | Leave a comment

Using the PageRequestManager in ASP.Net AJAX (ATLAS)

In your java script::   var postBackElem; Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoadedHandler); function BeginRequestHandler(sender, args) { postBackElem = args.get_postBackElement(); } function PageLoadedHandler(sender, args) { var c = ‘panels created: ‘; var u = ‘panels updated: ‘;   for(var i=0;i c += args.get_panelsCreated()[i].id + … Continue reading

Posted in JavaScript, Microsoft AJAX | Leave a comment

Using predicates for Find / FindAll methods on generic List<T> in C#

The call to FindAll: myDerivedClass.FindAll(MyBaseClass.AnyWordInNameStartsWith(partialName)); Within MyBaseClass.cs:   public static Predicate AnyWordInNameStartsWith(string partialName) where T:MyBaseClass, new() { return delegate(T myClass) { partialName = partialName.ToLowerInvariant();   if (myClass.Name.ToLowerInvariant().StartsWith(partialName)) { return true; }   List words = new List(); string[] splWords = … Continue reading

Posted in C# | Leave a comment

FireFox caches JavaScript state

Firefox uses in memory caching for JavaScript and can cause strange errors in your MSFT ASP.NET Ajax applications. Try adding this to your load event to prevent those errors:   if (Request.Browser.MSDomVersion.Major == 0) // Non IE Browser?) { Response.Cache.SetNoStore(); … Continue reading

Posted in C#, FireFox, JavaScript | Leave a comment