Spence Green

التكرار يعلم الحمار

I work at Lilt. In addition to computers and languages, my interests include travel, running, and scuba diving. more...

Archive for the ‘.NET’ Category

Two Useful, Totally Unrelated ASP.NET Topics

without comments

Here are two coding tips that I have found useful in recent days:

Explanatory text in a textbox can force the user to read directions. The textbox could say something like, “Enter search terms here separated by commas.” But when the user places the cursor inside the textbox, the instructions should clear. The standard ASP.NET textbox control does not have an OnFocus event, but the same effect may be achieved with JavaScript. Add an attribute to the textbox control during the Page_Load event:

//Note that value is set to an empty string (two single quotes)

Some ASP.NET controls use JScript Eval statements for databinding. In some cases, you may want to include single and double quotes in the Eval format string. Use HTML escape sequences in place of quotes:

Single quote: '
Double quote: "

Consider the following example, which uses an Eval format string:

   < %# Eval("Url","this.window.href=&apos;{0}&apos;") %>

Written by Spence

November 29th, 2007 at 3:18 pm

Posted in ASP.NET

Learning CSS for ASP.NET

without comments

Several weeks ago, I started implementing an ASP.NET 2.0 interface for a postal systems project. Although I had previous experience with n-tier web architectural design, the ASP.NET programming model was new to me, as were the constellation of languages and constructs used in modern web design. My first objective was to prototype all screens in the new interface. Initially, I thought of using Visio to layout the content, but I soon realized that it’s better to put a working “skeleton” in front of the user. The skeleton may lack tier 2 connections, but it should represent the interaction model, which includes:

  • Link structure between forms.
  • Dynamic, client-side content such as hover boxes and timers.
  • Proposed color scheme, which is an accessibility concern for colorblind users.
  • Site-wide style sheets.

Read the rest of this entry »

Written by Spence

November 27th, 2007 at 10:50 am

Posted in ASP.NET

std::string in the Visual Studio .NET Debugger

with 30 comments

The VS.NET 2003 debugger evidently displays only the first 256 characters of a std::string. It terminates the string with “/H”. I could find no documentation about this behavior. Output the string to the console to ensure its validity:

std::string temp; //A long string
Console::WriteLine(new String(temp.c_str()));

Written by Spence

July 14th, 2005 at 11:33 am

Posted in .NET