Posted on September 19th, 2006%
On September 6, the guys at Microsoft released the second beta version of their CSS Friendly ASP.Net 2.0 Control Adapters. In addition to bug fixes were CSS implementations of the membership controls – specifically, the Login, CreateUserWizard, PasswordRecovery, LoginStatus, and ChangePassword controls.
Unfortunately for the membership controls, it didn’t really work. This bothered me, because I’ve been using a hacked version of these controls that strips out TABLE-related tags for some time. The hacks work, but they’re hacks, and they have some quirky behavior.
I wrote a post on the ASP.Net forums, in which I described the problem.
I was glad to see that membership controls were added to the latest beta release. However, I did notice that all of them (with one exception) still put a TABLE wrapper around the content when using a templated control. It happens on the Login and PasswordRecovery controls…
Ironically, the CreateUserWizard did not add a table wrapper around the CreateUserWizardStep — but it did add . . .
→ Read More: CSS Adapters for Membership Controls (working versions)
Posted on September 8th, 2006%
For the past few years, I’ve been doing a lot of web development. Part of my design mantra (at least from a code perspective) is table-less design using CSS that works in as many browsers as humanly possible.
Since Firefox‘s support for CSS standards is superior to that of IE, I generally code everything so it looks good in Firefox, then apply hacks to get it to work in IE. (Most other browsers require minimal tweaking once something works well in Firefox and IE.) At times, the hack is to add some IE-specific CSS code, which is usually done using the asterisk hack:
.myClass {
background-color:white;
}
* html body .myclass {
background-color:black;
}
Only IE recognizes the second line, so in IE, the background color of any element with the myClass class will be black; for all other browsers, it will be white.
However, this hack can be replaced by one I found today, which is beautifully simple and elegant: add an underscore before the CSS property . . .
→ Read More: A wonderfully simple, wonderfully useful IE CSS hack
Posted on April 18th, 2006%
About two months ago, I wrote a post about removing the TABLE from ASP.Net 2.0′s Login control. The below code will let you do the same from the CreateUserWizard control. One important caveat: for this to work (in my limited testing), you must provide a custom template for the ContentTemplate and CustomNavigationTemplate of the CreateUserWizardStep, and for the ContentTemplate of the CompleteWizardStep.
public class CssCreateUserWizard : System.Web.UI.WebControls.CreateUserWizard
{
protected override void Render( HtmlTextWriter writer )
{
if ( CreateUserStep.ContentTemplate != null && this.ActiveStep == this.CreateUserStep )
{
WebControl creatediv = new WebControl( HtmlTextWriterTag.Div );
creatediv.CssClass = this.CssClass;
CreateUserStep.ContentTemplate.InstantiateIn( creatediv );
. . .
→ Read More: Removing the TABLE from the CreateUserWizard control
Posted on February 28th, 2006%
Microsoft has been touting ASP.Net 2.0 as taking great strides towards XHTML compatibility and meeting common accessibility guidelines. However, some controls still add table tags around them, despite your best efforts to avoid using tables. The new Login control is one of those.
For me, the table wrapper around the Login control was causing rendering problems. I was using a pure CSS layout with no tables for the login form, and the presence of the table tag wrapped around the control was breaking my layout. A quick Google search (q=asp.net+2.0+login+control+table) found a blog post that outlined a solution.
The fix was simple: create a new class, inherit from the existing System.Web.UI.WebControls.Login class, and override the Render method. A few lines of code, and the table wrapper was replaced with a div wrapper. There was one catch: the version posted on the aforementioned blog didn’t include the CssClass attribute on the new control. One extra line of code fixed that.
Below is . . .
→ Read More: Removing tables in Microsoft’s ASP.Net 2.0 Controls
Posted on October 11th, 2005%
The folks from Particletree have released the first issue of Treehouse, a magazine dedicated to Web development. Get the first issue – it’s a free PDF download – and considering the reputation of those at Particletree, it’s worth the cost.
. . .
→ Read More: New web developer magazine, "Treehouse"