Removing tables in Microsoft’s ASP.Net 2.0 Controls

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 the code, all but one line thanks to Alex Gorbatchev of dreamprojections.com:

    public class CssLogin : System.Web.UI.WebControls.Login
    {
        protected override void Render( HtmlTextWriter writer )
        {
            WebControl div = new WebControl( HtmlTextWriterTag.Div );

            LayoutTemplate.InstantiateIn( div );

            Controls.Clear();
            Controls.Add( div );

            div.CopyBaseAttributes( this );
            div.CssClass = this.CssClass;
            div.RenderControl( writer );
        }
    }

SalesLogix command line switches not working?

For the better part of the past 12 months, I’ve been handling the implementation of SalesLogix, a customer relationship management (CRM) product by Sage Software (formerly Best Software), for one of my clients. In my travels, I’ve found that command line switches for the various SalesLogix applications (such as the Sales Client or Administrator) don’t always work. After some noodling yesterday, I found out why.

First, a little background. Below is excerpts from a knowledge base article outlining how to use the SalesLogix command line switches.

The Sales Client has a series of command line switches which can be used to log on to the Sales Client. For example, a desktop shortcut can be created containing parameters to log on to a specified database. The switches are as follows:
/n is the username
/p is the user password
/b is the “log on to” database alias

Examples:
To point to the database “SLX”, and log on as user “jdoe” with password “mypwd”, the value of Target would be “C:|Program Files\SalesLogix\SalesLogix.exe” /b SLX /n jdoe /p mypwd“…

Easy enough. However, it doesn’t work if current user logged in to Windows has a SalesLogix account set up to use Windows authentication. SalesLogix has a feature where “users are automatically logged on without entering their SalesLogix user names or passwords. Users’ Windows IDs are stored in the SalesLogix database paired with their SalesLogix user names and passwords” (from SalesLogix Administrator Help). Unfortunately, if you have this set for a user, that user will not be able to use command line switches for the SalesLogix Client. (The Administrator or Architect, which do not allow any kind of passthrough authentication, don’t experience this problem.)

To fix the problem, remove the user’s Windows passthrough authentication. Hopefully this little tidbit helps those out there who’ve been scratching their heads over this (like I was).