Posts

Showing posts from September, 2004

ASP.NET.4GuysFromRolla.com: Dynamic Web Controls, Postbacks, and View State

Useful article on how to handle controls that are dynamically added to ASP.NET pages: ASP.NET.4GuysFromRolla.com: Dynamic Web Controls, Postbacks, and View State

Defending The Fox / Spread Firefox

Defending The Fox is a site that lists websites that do not support Firefox (those that suggest users to 'upgrade' to IE 5 or later. This was found on the Spread Firefox site (a site to get people to move to the Firefox browser). They succesfully achieved 2 million downloads in 10 days (very good considering the target was 1 million). Now they want 10,000 new users in 10 days.

.NET Command Prompt

This batch file allows you to do various .NET related tasks. This is useful when running under a limited user account. To do the advanced tasks you need to know the local machine administrator password. Features include: Goto .NET SDK, .NET bin folder Show .NET help file Start Web Browser Administrate folders (i.e. set permissions) Administrate the computer List .NET related files DotNetCommand.cmd @echo off rem .NET SDK bin directory set NetSDKBin=%NetSamplePath%bin rem .NET bin directory set DotNetBin=%windir%\Microsoft.NET\Framework\v1.1.4322 set PATH=%DotNetBin%;%NetSDKBin%;%PATH% color 1f rem goto directory as supplied (i.e. via dragging onto batch file) cd %1 rem register doskey doskey /insert rem go to .NET SDK bin directory doskey sdkdir=cd "%%NetSamplePath%%" rem go to .NET bin directory doskey netbin=cd "%%DotNetBin%%" rem start Web Browser, homepage set to Google doskey webbrowser=start http://www.google.com rem .NET...

Client-Side Validation (ASP.NET)

There is a way of getting ASP.NET to output JavaScript that works in other browsers, and it is detailed in this 4Guys article: Client-Side Validation in Downlevel Browsers . Also vote for the following bug at MSDN Labs so ASP.NET 2.0 outputs cross-browser JavaScript: Client Side Validation .

Entity Spaces (.NET)

Entity Spaces will become the successor to dOOdads . These are (will be in the case of Entity Spaces) .NET architectures and provide a data access layer to allow developers to interact (add, update, delete records) with any database system (Access, SQL Server, Oracle, Firebird) without needing to code for the underlying database (i.e. SQL Parameters). With these you can change your database backend without needing to change all your code (except the data access classes, which can be generated via a simply UI). Follow the progress in Mike Griffin's Blog . Edit (27 Sep 04): blog link update

Url Manipulation v2 (C#)

Made some improvements to the previous UrlQuery class (July 22nd, 2004). It now has a shorter way of assigning QueryString parameters: MyQuery = new UrlQuery(); // add another parameter (or replace existing one) MyQuery["myparam"] = "myval"; Trace.Write(MyQuery["myparam"]); // returns 'myval' // remove parameter MyQuery["myparam"] = null; // or string.Empty Trace.Write(MyQuery["myparam"]); // returns '' UrlQuery class code: public class UrlQuery { /// <summary> /// Base on current page /// </summary> public UrlQuery() { this.url = HttpContext.Current.Request.Url.AbsolutePath; } /// <summary> /// Base on other page /// </summary> /// <param name="value">The url of the page to reference, i.e.: '/path/to/folder/page.aspx?param1=1&param2=2'</param> public UrlQuery(string value) { int q = value.IndexOf('?'); i...

Get Firefox

Image
Best web browser at the moment.

SharpDevelop 1.0 (.NET)

SharpDevelop version 1.0 is now finally out. While it doesn't do ASP.NET, it is useful for compiling .NET libraries (i.e. dll files, can be used for both Windows and Web Forms).

Building Web Applications with NAnt (ASP.NET)

NAnt allows you to build web applications from solution files when you do not have Visual Studio installed (or even when you do). To do so you need to install NAnt into a new directory (e.g. C:\NAnt\ ). After doing this add C:\NAnt\bin\ to your PATH (via System Properties, Advanced, Environment Variables, System Variables). Also add the path to the vbc/csc compilers (if not already there - C:\WINNT\Microsoft.NET\Framework\v1.1.4322\;C:\NAnt\bin\ ). To then compile the solution, add WebProjectName.build to the same folder as the solution (i.e. C:\Inetpub\wwwroot\WebProjectName\ ) and add the following to it: <project name="WebProjectName"> <property name="nant.settings.currentframework" value="net-1.1"/> <property name="Host" value="http://localhost" /> <property name="Path" value="c:\inetpub\wwwroot" /> <property name="WebProjectName.Host" value="${Host}/WebProj...

Internet Explorer Hacks (CSS)

The following shows how you can hide/show CSS for certain versions of Internet Explorer (works when page is in standards mode - i.e. DOCTYPE at top of page): mytag { /* all browsers */ property: value; /* IE only browsers */ _property: value; /* ignored by IE 5, works in IE 5.5/6 */ property /**/: value; /* ignored by IE 5.5, works in IE 5/6 */ property/**/: value; /* ignored by IE 6, works in IE 5/5.5 */ property: /**/value; /* all browsers */ property2: value; /* voice-family hack - any code after 'voice-family' not recognised by IE5/5.5 */ voice-family: "\"}\""; voice-family: inherit; property2: newvalue; } CSS Filters also lists many filters for delivering certain CSS to different browsers. Edit: CSS Filters link, more IE filtering methods - so you can serve different CSS to IE 5 / 5.5 and 6

Generate SQL Server Views (MyGeneration) pt2

Added another template that generates a related table view (i.e. via INNER JOIN statement). Select primary/foreign table and which columns are to be in the view. Same link as before - Generate SQL Server Views .

Generate SQL Server Views (MyGeneration)

Added a new MyGeneration template archive that contains a template that generates views from your tables (SQL Server) - Generate SQL Server Views . Returns NULL's if blank string and column allows NULL's. Also breaks down dates into component parts (i.e. Month, Day, Year) and to other formats: Short Date (mon dd yyyy) Short Time (hh:mm) US Date (mm/dd/yyyy) ANSII Date (yyyy.mm.dd) UK Date (dd/mm/yyyy) German Date (dd.mm.yyyy) Italian Date (dd-mm-yyyy) Example Output: USE [news] GO IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'vw_News') DROP VIEW vw_News GO CREATE VIEW [vw_News] AS SELECT [ID] AS [NewsID], NULLIF ([Title], '') AS [News Title], NULLIF ([Url], '') AS [News Url], [Added] AS [Date Added], CONVERT ( char(11) , [Added] , 113) AS [Date Added_ShortDate], CONVERT ( char(5) , [Added] , 108) AS [Date Added_ShortTime], CONVERT ( char(10) , [Added] , ...