Use Multiple CSS Classes on a Single Element
Posted by: admin in .NET Development Blog on April 8th, 2009
One of the lesser known tricks with CSS is the fact that you don’t have to limit your elements to just one class. If you need to set multiple classes on an element, you add them simply by separating them with a space in your attribute. For example:
<p class=”pullquote btmmargin left”>…</p>
You would assign these as generic classes in your CSS:
.pullquote { … }
.btmmargin { … }
p.left { … }
If you set the class to a specific element, you can still use it as part of a list of classes, but be aware that it will only affect those elements that are specified in the CSS.
Advantages of Multiple Classes
Multiple classes can make it easier to add special effects to elements without having to create a whole new style for that element. For example, you may want to have the ability to float elements to the left or right quickly. You might write two classes “left” and “right” with just “float:left;” and “float:right;” in them. Then whenever you had an element you need to float left you would simply add the class “left” to its class list.
I like to use multiple classes for things that I want to keep standard across the entire site. For example, if I always want the bottom-margin for elements that have a bottom-margin to be 10px. By creating a class that only encompases the botom-margin:10px; I can add it wherever it’s needed.
Disadvantages of Multiple Classes
While they are supported in the major browsers, really old browsers don’t support them. So you should make sure that the first class you list is the one with the most specific information for that element.
Multiple classes can also get really confusing as you apply more and more to an element
Source: http://webdesign.about.com/od/css/qt/tipcssmulticlas.htm
List of Request.ServerVariables
Posted by: admin in .NET Development Blog on March 31st, 2009
| ALL_HTTP | HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:sv HTTP_HOST:localhost:1229 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) |
| ALL_RAW | Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Accept-Language: sv Host: localhost:1229 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) |
| APPL_MD_PATH | |
| APPL_PHYSICAL_PATH | D:\code\web\demos\membership\ |
| AUTH_TYPE | NTLM |
| AUTH_USER | SYSTEMEN-D9AE02\Stefan Holmberg |
| AUTH_PASSWORD | |
| LOGON_USER | SYSTEMEN-D9AE02\Stefan Holmberg |
| REMOTE_USER | SYSTEMEN-D9AE02\Stefan Holmberg |
| CERT_COOKIE | |
| CERT_FLAGS | |
| CERT_ISSUER | |
| CERT_KEYSIZE | |
| CERT_SECRETKEYSIZE | |
| CERT_SERIALNUMBER | |
| CERT_SERVER_ISSUER | |
| CERT_SERVER_SUBJECT | |
| CERT_SUBJECT | |
| CONTENT_LENGTH | 0 |
| CONTENT_TYPE | |
| GATEWAY_INTERFACE | |
| HTTPS | |
| HTTPS_KEYSIZE | |
| HTTPS_SECRETKEYSIZE | |
| HTTPS_SERVER_ISSUER | |
| HTTPS_SERVER_SUBJECT | |
| INSTANCE_ID | |
| INSTANCE_META_PATH | |
| LOCAL_ADDR | 127.0.0.1 |
| PATH_INFO | /membership/servervariables.aspx |
| PATH_TRANSLATED | D:\code\web\demos\membership\servervariables.aspx |
| QUERY_STRING | |
| REMOTE_ADDR | 127.0.0.1 |
| REMOTE_HOST | 127.0.0.1 |
| REMOTE_PORT | |
| REQUEST_METHOD | GET |
| SCRIPT_NAME | /membership/servervariables.aspx |
| SERVER_NAME | localhost |
| SERVER_PORT | 1229 |
| SERVER_PORT_SECURE | 0 |
| SERVER_PROTOCOL | HTTP/1.1 |
| SERVER_SOFTWARE | |
| URL | /membership/servervariables.aspx |
| HTTP_CONNECTION | Keep-Alive |
| HTTP_ACCEPT | */* |
| HTTP_ACCEPT_ENCODING | gzip, deflate |
| HTTP_ACCEPT_LANGUAGE | sv |
| HTTP_HOST | localhost:1229 |
| HTTP_USER_AGENT | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) |
Request.ServerVariables(”SERVER_NAME”)
Request.ServerVariables(”PATH_INFO“)
Introducing IE=EmulateIE7
Posted by: admin in .NET Development Blog on March 27th, 2009
“Bill Gates’ recent Tech Ed keynote and Tony Chor’s follow-up blog announced that IE8 Beta 2 will be available in August in many languages. We are encouraging sites to get ready for Beta 2 prior to release as it will present a big jump in IE8 browsing traffic.
What does “getting ready for IE8” mean for web sites? IE8 displays content in IE8 Standards mode – its most standards-compliant layout mode – by default. In previous blog posts, we’ve discussed how this aligns with our commitment to Web standards interoperability. However, browsing with this default setting may cause content written for previous versions of IE to display differently than intended. This creates a “get ready” call to action for site owners to ensure their content will continue to display seamlessly in IE8.
The preferred response to this call to action is to update the site to ensure that IE8 is provided with standards content fitting the DOCTYPE. However, we know it is very important to give site owners the chance to update site content on their schedule without affecting user experience. As such, we provide a meta-tag that tells IE8 to display an entire site or a specific page like it did in IE7.
In IE8 Beta 1, that option is the “IE=7” X-UA-Compatible tag, which instructs IE8 to display content in IE7 Standards mode. However, the scenario this doesn’t address is when IE=7 is applied as an HTTP header to a site that contains Quirks mode pages. The IE=7 HTTP header will force all pages – both Quirks and Standards – to display in IE7 Standards mode. Developers using this header while updating their sites would then have to add the “IE=5” tag to each page they want to keep in Quirks mode. This logic is fine for many websites. However, if a site has lots of Quirks mode pages, or for the case where pages with frames host a mix of Strict and Quirks mode content – as brought to light by IE8 Beta 1 user feedback – the compatibility opt-out adds a bit more work than we intended.
In response to the great IE8 Beta 1 feedback we’ve received so far, we are introducing the “IE=EmulateIE7” tag to address this problem. EmulateIE7 tells IE8 to display standards DOCTYPEs in IE7 Standards mode, and Quirks DOCTYPEs in Quirks mode. We believe this will be the preferred IE7 compatibility mode for most cases. Support for IE=EmulateIE7 is available now as part of the IE June Security Update for IE8 Beta 1. Installing this update will enable you to verify you’ve applied the EmulateIE7 tag to your site correctly. ”
http://blogs.msdn.com/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx
SMTP server: The transport failed to connect to the server
Posted by: admin in .NET Development Blog on March 25th, 2009
- ->
<%@Import Namespace="System.Web.Mail" %>
<%
string strTo = emailToAddress;
string strFrom = Request.Form["txtemail"];
string strSubject = "Franchise Inquiry";
MailMessage mail = new MailMessage();
mail.From = new MailAddress(strFrom);
mail.To.Add(strTo);
BodyText = " " + "\n";
BodyText = BodyText + "First Name: " + Request.Form["txtfirstname"] + "\n";
BodyText = BodyText + "Last Name: " + Request.Form["txtlastname"] + "\n";
mail.Subject = strSubject;
mail.Body = BodyText;
SmtpClient smtp = new SmtpClient("127.0.0.1"); //"rechannel.com"
smtp.Send(mail);
Error: SMTP server: The transport failed to connect to the server
Solution: Firstly if you are using asp.net 2.0 or newer then you should be using System.Net.Mail rather than System.Web.Mail.
http://forums.asp.net/t/1385665.aspx
From http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx
Sending Email with System.Net.Mail
.NET 2.0 includes much richer Email API support within the System.Net.Mail code namespace. I've seen a few questions from folks wondering about how to get started with it. Here is a simple snippet of how to send an email message from “sender@foo.bar.com” to multiple email recipients (note that the To a CC properties are collections and so can handle multiple address targets):
Compiler Error Message: CS0104: ‘MailMessage’ is an ambiguous reference between ‘System.Web.Mail.MailMessage’ and ‘System.Net.Mail.MailMessage’
that class is known in both namespaces hence the error. Since you’re using .NET 2.0 remove the line
Imports System.Web.Mail
Unable to read data from the transport connection: net_io_connectionclosed.
What this error means is that System.net.mail was unable to find the smtp server.
The answer will vary depending on whether you have a fixed IP or a dynamic IP but,
basically, you need to assign a valid IP to your smtp server.
With fixed IP’s this is relatively straightforward.
With dynamic IP’s it takes a bit of tweaking.
Open the IIS Manager and check the properties for the smtp server.
In the Default SMTP Virtual Server’s properties, in the “Access” tab,
in the Connection Control and Relay dialogs, make sure that your local IP is assigned.
( In my case, it’s 10.0.0.2… )
You may also need to modify your hosts file, to point 127.0.0.1 to your machine name.
( \WINDOWS\system32\drivers\etc\hosts )
Then, in your code, assign your machine name to the smtp client :
Dim client As New SmtpClient(”yourmachinename”)
client.Send(mail)
How to Install Two Versions of IE
Posted by: admin in .NET Development Blog on March 3rd, 2009
http://webdesign.about.com/od/internetexplorer/ig/IE-6-and-7-on-the-Same-Machine/index.01.htm
http://ellisweb.net/2006/10/running-two-versions-of-internet-explorer-simultaneously/
http://stackoverflow.com/questions/135057/internet-explorer-8-and-ie-6-side-by-side
Jules Horowitz, B-17 pilot, 99th BG, 50 missions/sorties
Posted by: admin in Photography Blog on February 13th, 2009
“I just finished spending about 9 days at Florida’s 3 stops, Boca Raton, Pompano Beach and Ft Lauderdale. My time was spent at or around the B17, answering questions and speaking to people, many of them seeing the planes for the first time , living history, speaking to a dinosaur.
One day as I was leaving the airport one of the Collings people told me that a gentleman made a donation, paying for a ride for a veteran. He chose me, little did I know what I was in for. It took 2 crew members to get me to a position behind the pilots position. One man behind me lifting me, the other manipulating my feet. Exiting the plane was just as difficult, but the ride was well worth it, it brought back memeoies of when I was 20 years old.”
Jules Horowitz, B-17 pilot, 99th BG, 50 missions/sorties
His tour was from 7/19/43-2/13/44
.NET | Failed to load viewstate?
Posted by: admin in .NET Development Blog on February 11th, 2009
Today I am working on one of our Real State Agent’s website and I came across with the following error:
Server Error in ‘/’ Application.
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
After a short research I found http://geekswithblogs.net/FrostRed/archive/2007/02/17/106547.aspx which explains in depth what really ViewState: “the ViewState tree (type of Triplet or Pair) is NOT the ViewState property (type of StateBag) of the page or any of its controls. You can think it as an object representation of the ViewState value on the html page (the __VIEWSTATE hidden field), which contains all the values need to be written back to the controls during a page postback. If you don’t change the default behavior, during the page initialize/load phrase, the ViewState tree will be created by de-serializing the value __VIEWSTATE field by LoadPageStateFromPersistenceMedium(), and the values on the ViewState tree will be put into the controls ViewState bag in LoadViewState() . During the page save/render phrase, the ViewState tree will be created again by SaveViewState (), then serialized and written onto html page by SavePageStateToPersistenceMedium ()”
This help me to have a better understanding of viewstate but did not solve the issue, then I found http://weblogs.asp.net/alessandro/archive/2008/01/04/failed-to-load-viewstate-typical-problem-with-an-obvious-solution.aspx which mentioned that this error can be caused by “changing the order of controls, that is, when your loading a dynamic control, make sure the order in which you create it, has the same order when you recreate it.”
After reading at this article, I noticed that the HTML portion of my Server Control looked like this:
<div><asp:literal id=”BizCardTitle” runat=”server”></asp:literal></div>
<div><cc1:remsimage runat=”server” id=”img_BizCardPhoto”></cc1:remsimage></div>
But my code behind shows:
Me.LoadImage(objContact.ImageID)
LitBizCardTitle.Text = m_objSite.OwnerTitle
Rearranging the controls solve the problem. I recalled changing the order on the HTML portion only. This changed the order in which controls are added after postback. Therefore the viewstate loaded Me.LoadImage(objContact.ImageID) into LitBizCardTitle.Text and biceverse.
Percy Dyer
.NET Web Application Developer
!important in CSS
Posted by: admin in .NET Development Blog on February 6th, 2009
CSS takes precedence over a normal declaration. Both author and user style sheets may contain “!important” declarations, and user “!important” rules override author “!important” rules. This CSS feature improves accessibility of documents by giving users with special requirements (large fonts, color combinations, etc.) control over presentation.
Example(s)”
/* From the user’s style sheet */
P { text-indent: 1em ! important }
P { font-style: italic ! important }
P { font-size: 18pt }
/* From the author’s style sheet */
P { text-indent: 1.5em !important }
P { font: 12pt sans-serif !important }
P { font-size: 24pt }
WWII vintage planes stop in South Florida
Posted by: admin in Photography Blog on February 4th, 2009
BOCA RATON, FL — As U.S. air power rocked Germany during World War II, Archie L. Carswell, then 18, was at a base in England loading bombs, ammunition and supplies on B-17s and B-24s.
So when he heard that a few of the vintage planes were touching down at an airport near his Boca Raton home, he brought Irene, his wife of 65 years, to see them.
“They bring back memories,” said the 86-year-old, one of several U.S. Army Air Corps veterans who welcomed the airplanes at Avitat Boca Raton, 3300 Airport Road. “That’s why I am here. I want to see what they look like now.”
Carswell had basic training on the Avitat site and met his wife a month after coming to Boca Raton from Georgia.
“We came here, got your training, go over, fought a war and came back,” he said. “It makes me feel good that I survived because a lot of us didn’t make it back home to see this.”
South Floridians wishing to relive a bit of history can do so until Feb. 8 while the planes are here and in Broward County Click here for restaurant inspection reports. The last B-24 bomber in the world, a B-17 Flying Fortress and a P-51C Mustang fighter will be on display at Avitat through Sunday.
The Massachusetts-based Collings Foundation’s annual Wings of Freedom Tour then will move to Anthony Aviation at Pompano Beach Air Park Wednesday through Friday and Hangar 63 at Fort Lauderdale Is your Fort Lauderdale restaurant clean? - Click Here. Executive Airport Feb. 6-8.
Several aviation buffs, mostly octogenarians and veterans of that last big war, shared stories as they milled around the planes.
“It’s a really mixed blessing,” said John Bury, 87, who flew 28 combat missions as a navigator in a B-17.
The Highland Beach resident flew on a B-17 again last year, which evoked a mixture of “some chills and some very happy, pleasant memories.”
