Friday, March 09, 2007

If you are using a cancel button on a .NET Web Form and it's causing your page to trigger the validation you can set the CausesValidation property to false. It's set to true by default. Often you don't want to user to have to pass your validation before canceling a form - they might have decided not to enter the new record or not know the required data.

<asp:Button ID="CancelButton" CommandName="Cancel" Text="Cancel" Width="50" CausesValidation="False" runat="Server" />

3/9/2007 1:25:55 PM (Eastern Standard Time, UTC-05:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, October 25, 2006
10/25/2006 1:46:24 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, August 15, 2006

This is just a quick tip, but if you ever have problems converting your Coldfusion form values to a SQL Server database NULL before using an Insert or Update statement, the following info might help.

When you request form values from the submitting page make sure to use CFPARAM and give each form value submitted a default value, or just set to "" if the value doesn't matter.

<CFPARAM name="form.yourValue" default="">

Then when you execute your SQL command use CFQUERYPARAM to pass the value to SQL Server. Set the cfsqltype to your required data type. The trick to inserting the database null is to use the "null" attribute of CFQUERYPARAM. If you know that the form value will be null you can just pass the value directly to the "null" attribute, but if you don't know if a user has passed any data then check to see if you are passing an empty string and use the Coldfusion function YesNoFormat to create a Yes or No value for the "null" attribute.

It's not really as confusing as I made it sound - just use the the code snippet below and Coldfusion will create your database null values for you.

<CFQUERYPARAM value="#form.yourValue#" null="#YesNoFormat(NOT Len(Trim(form.yourValue)))#" cfsqltype="CF_SQL_INTEGER" />

Note:

For checkboxes you have to convert the value to 1 or 0 before using it in a SQL command. I just created a little function I call to do this:

function fixCheckbox(value) {
    var x
= "";
    
    
if (value EQ "on") {
        x
= 1;
    }
    
else {
        x
= 0;
    }        
    
return x;
}

8/15/2006 2:16:36 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, August 07, 2006

If your CSS doesn't seem to be rendering correctly even though you are 99.99% sure you're using the correct markup double check the doctype. If you don't explicitly set the doctype to transitional or strict the browser will default to CSS 1.0 specifications and many CSS 2.0 features aren't supported in the older version.

Make sure this is above the <html> tag:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Understanding DOCTYPE:

http://www.alistapart.com/articles/doctype/

 

CSS
8/7/2006 2:26:09 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, June 19, 2006

This tip is from DWTIPS - it's a good one. To reduce the time it takes to load a PDF you can disable some of the plug-ins that load everytime Acrobat is started up. Here's how you do it:

To disable unneeded plugins and make them optional instead, follow these instructions:

  1. Install the latest version of Adobe Acrobat - you can get it here
  2. Browse to the plugins folder: C:\Program Files\Adobe\Acrobat 7.0\Reader\plug_ins
  3. Create a new folder named Optional
  4. Move all files from the plug_ins folder to Optional, except EWH32.api, print*.api, and Search*.api
6/19/2006 1:38:04 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Wednesday, May 31, 2006

Microsoft recently launched a new IIS website. The site is mainly dedicated to IIS 7. It has some pretty cool utilities and lets you try out IIS7 through your browser. It might be worth checking out when you have a chance.

http://www.iis.net/

ASP.NET | IIS
5/31/2006 8:27:29 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, May 24, 2006

Andy Hume posted an intersting article on bitesizestandards.com . It talks about positioning <divs> located on the source document in any order through css. Normally <divs> order themselves on the page according to the order they are placed on the page.

Here is a link to the article:

http://bitesizestandards.com/bites/understanding-any-order-columns

CSS
5/24/2006 10:34:20 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, April 21, 2006

Typical Problem: ASP.NET <asp:login> works fine when tested locally, but doesn't work when deployed.

If you are setting up an ASP.NET application for deployment it's best to explicitly define the applicationName property on your membership provider - otherwise when you go to deploy the application you might run into problems.

The applicationName property in the web.config has to match the application path or application name of the web application - the paths are generally going to be different between your test and production environments.

So, the best way to make sure web.config stays correct for test and production is to set the application name through IIS.

Note:

Another thing to look out for when using the LoginView is that the control does not use the membership provider - it uses FormsAuthentication (for login status) and the RoleProvider for specific roles. You need to put the ApplicationName in your role provider as well:


<roleManager enabled="true" defaultProvider="SqlRole">
  <providers>
    <add name="SqlRole"
    connectionStringName="YOUR_CONNECTION"
    applicationName="appName" />
  </providers>
</roleManager>

 

 

4/21/2006 3:24:00 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [4]  |  Trackback