Monday, March 19, 2007

dropdown states




-- Select --
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
District of Columbia
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming


public string SelectedValue
{
get
{
return ddlStates.SelectedValue;
}
set
{
ddlStates.SelectedValue = value;
}
}

*

public string id
{
set
{
ddlStates.ID = value;
}
}

public string ValidationEnabled
{
set
{
rfvStates.Enabled = Convert.ToBoolean(value);
}
}

public string ValidationGroup
{
set
{
ddlStates.ValidationGroup = value;
rfvStates.ValidationGroup = value;
}
}

public string ValidationErrorMessage
{
set
{
rfvStates.ErrorMessage = value;
}
}

public string SelectedValue
{
get
{
return ddlStates.SelectedValue;
}
set
{
ddlStates.SelectedValue = value;
}
}

public short TabIndex
{
set
{
ddlStates.TabIndex = value;
}
}

Thursday, March 08, 2007

state abbreviations list (Dictionary)

Dictionary stateabbrs = new Dictionary();

stateabbrs.Add("Alabama","AL");
stateabbrs.Add("Alaska","AK");
stateabbrs.Add("Arizona","AZ");
stateabbrs.Add("Arkansas","AR");
stateabbrs.Add("California","CA");
stateabbrs.Add("Colorado","CO");
stateabbrs.Add("Connecticut","CT");
stateabbrs.Add("Delaware","DE");
stateabbrs.Add("Florida","FL");
stateabbrs.Add("Georgia","GA");
stateabbrs.Add("Hawaii","HI");
stateabbrs.Add("Idaho","ID");
stateabbrs.Add("Illinois","IL");
stateabbrs.Add("Indiana","IN");
stateabbrs.Add("Iowa","IA");
stateabbrs.Add("Kansas","KS");
stateabbrs.Add("Kentucky","KY");
stateabbrs.Add("Louisiana","LA");
stateabbrs.Add("Maine","ME");
stateabbrs.Add("Maryland","MD");
stateabbrs.Add("Massachusetts","MA");
stateabbrs.Add("Michigan","MI");
stateabbrs.Add("Minnesota","MN");
stateabbrs.Add("Mississippi","MS");
stateabbrs.Add("Missouri","MO");
stateabbrs.Add("Montana","MT");
stateabbrs.Add("Nebraska","NE");
stateabbrs.Add("Nevada","NV");
stateabbrs.Add("New Hampshire","NH");
stateabbrs.Add("New Jersey","NJ");
stateabbrs.Add("New Mexico","NM");
stateabbrs.Add("New York","NY");
stateabbrs.Add("North Carolina","NC");
stateabbrs.Add("North Dakota","ND");
stateabbrs.Add("Ohio","OH");
stateabbrs.Add("Oklahoma","OK");
stateabbrs.Add("Oregon","OR");
stateabbrs.Add("Pennsylvania","PA");
stateabbrs.Add("Rhode Island","RI");
stateabbrs.Add("South Carolina","SC");
stateabbrs.Add("South Dakota","SD");
stateabbrs.Add("Tennessee","TN");
stateabbrs.Add("Texas","TX");
stateabbrs.Add("Utah","UT");
stateabbrs.Add("Vermont","VT");
stateabbrs.Add("Virginia","VA");
stateabbrs.Add("Washington","WA");
stateabbrs.Add("West Virginia","WV");
stateabbrs.Add("Wisconsin","WI");
stateabbrs.Add("Wyoming","WY");

Tuesday, July 18, 2006

Unable to add data connection. Key not valid for use in specified state. - MSDN Forums

solution:

1. Open the registry

2. Rename [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0]

To [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0back]

3. Restart Visual Studio

Monday, October 24, 2005

Forcing File Downloads

In C# (ASP.NET) it’s just as simple:

private void Page_Load(object sender, System.EventArgs e)
{
// Disable caching this page (C#)
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Buffer = true;
Response.ContentType = "application/binary";
Response.AppendHeader("Content-Disposition: attachment; " +
filename=dlimg.png");
Response.WriteFile(Server.MapPath("images/dlimg.png");
Response.End();
}

SimpleBits | Magic Icons for Lazy People (like me)

A neat little trick for those that want to change a site’s colors — but also create only one set of images that also reflects those changes. It’s been done on numerous sites, and I’ve employed the method on Fast Company with the redesign done back in April.
The idea is pretty darn simple, and works best with two-color images. Create a two-color .gif image and choose one of the colors to be transparent. Next, we’ll “fill in” the missing color with CSS using background. Change the CSS rule and the images will change with it. Very simple — but effective, and a heck of a lot simpler than creating multiple sets of icons.

Here’s an example (using inline styles to demonstrate). Below is a small little icon (13px x 13px) that is white and transparent. I’ll fill in the transparency with a few different colors using the same icon image, repeated:



On Fast Company I place icons within h3 headings and style them like this:


h3 img {
background: #369;
vertical-align: middle;
}
It’s important to note that because I’m using white as the visable color, the icons will be invisible on the un-styled version of the page. This could an unintended benefit. Keeping decorative images entirely in the CSS file using background-image is arguably a more ideal solution — but the chameleon effect you can create with one set of transparent images is a nice little trick.

Thursday, September 22, 2005

How to increase the request size limit and make possible the upload of larger files?

If you ever used the ASP.NET file upload control you may be
have noticed that if you try to upload a file which size
exceeds 4MB, the upload failes.
The reason for this is the ASP.NET precaution against
denial-of-service attacks which by default limits the
size of the requests at 4MB.
However if in your application you need to upload larger files
you may increase this limit, by simply modifying the
maxRequestLength attribute in your machine.config file
...

How to get the host name from an IP address?

public string getHost(string ip)
{
IPHostEntry IpEntry = Dns.GetHostByAddress(ip);
return iphostentry.HostName.ToString();
}

How to strip the HTML tags from text with C# and Regular expression?

string strResult = Regex.Replace(strInput,@"<(.|\n)*?>",string.Empty);

Thursday, June 23, 2005

Switch Options for Windows NT Boot.ini File

Available Switch Options for Windows NT Boot.ini File

SQL TRUNCATE

If you want to clear out a table in MS SQL that includes an identity field AND want to reset the field so it starts over at 1, use TRUNCATE instead of DELETE FROM.