Browser and Operating System Detection In ASP.NET

יום שני, ינואר 26, 2009

Hi, Detect user Browser and Operating System version in ASP.NET is very simple using the C# code: Request.Browser This code retuns the HttpBrowserCapabilities class that has the information we desire. Unfortunately the default Browser Caps configuration that come with ASP.NET 2.0 does not include browsers like Google Chrome and I could not find a way of getting the operating system version. Finally I came up with solution that solve my problem as describe below: On my ASP.NET application I open new ASP.NET folder: App_Browsers. I download updated *.browser files that contain the information on the Google Chrome browser and also the operating system version and copy them to the App_Browsers folder. You can get...

How to change ASP.NET CheckBox control Enabled property using javascript. bug or behavior?

יום רביעי, דצמבר 31, 2008

Changing status to enabled\disabled for regular input type checkbox in javascript is very simple. You just need to use the javascript code:var checkBox = document.getElementById("chkToTest"); checkBox.disabled = true\false; Well try to use this javascript code above on ASP.NET checkbox web control when you set the server side Enabled property to false like below: chkToTest.Enabled = false; I'm telling you it will not work!!!! Do you ask how to solve this bug or behavior? You just need to set the disabled property of the parent node also. something like this:var checkBox = document.getElementById("chkToTest"); checkBox.disabled = true; checkBox.parentNode.disabled = true; I don't know why but when setting the Enabled property of ASP.NET...

Compress and Consolidation of JavaScript and CSS files for .NET

יום ראשון, אוקטובר 12, 2008

Hi, There is cool open source project in codeplex called: Javascript and CSS Consolidation for ASP.NET that give infrastructure for compress and consolidation JS and CSS files for ASP.NET application. Project Description A library for ASP.NET that provides an easy way to consolidate external javascript and css files. The primary goals for this project are:* Make the development environment mirror production as much as possible (e.g. files should be consolidated in all environments including the local dev box)* Allow the developer to organize their scripts and styles in as many files as they please without compromising on performance* Make the process seemless for...