Wednesday, September 12, 2007

FREE Website Testing

Hi all,

now you can find new service from RichBrains here:
http://www.richbrains.net/FREE-website-testing.aspx.

Also, you could find more details about Rich Web and Software Development Company here:
http://www.richbrains.net

Tuesday, July 3, 2007

Box Model Hack by Edwardson Tan

Make valid font size in all browsers.

body { font-size: small; }
* html>body {
font-size: x-small; /* for IE5 / Win */
f\ont-size: small; /* fro other browsers */
}

DIV layout with height 100% solution

Index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<title>Rich Page</title>
<link rel="stylesheet" type="text/css" href="Styles.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form>
<div id="outer">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
<div id="footer_guarantor"></div>
</div>
<div id="footer">© 2007 RichBrains - Cusrom Web Development Company</div>
</form>
</body>
</html>

Styles.css

* { margin: 0; padding: 0; border: 0; }
html { height: 100%; }
body, form { min-height:100%; height: 100%; }
#outer { width: 100%; margin: auto; height: auto !important; min-height:100%; height: 100%; }
#footer_guarantor { height: 80px; clear: both; }
#footer { margin: auto; margin-top: -75px; width: 100%; height: 70px; clear: both; }

Monday, July 2, 2007

Strip Tags Method

If you need to strip tags, you can you the method detailed below.

public static string StripTags(string str)
{
str = Regex.Replace(str, @"]*>", " ", RegexOptions.IgnoreCase RegexOptions.Multiline);
str = Regex.Replace(str, @"<[^<>]*[>$]?", String.Empty, RegexOptions.IgnoreCase RegexOptions.Multiline);
str = str.Replace(" ", " ");
return HttpUtility.HtmlDecode(str.ToString());
}

Remove ViewState from the page

Need to optimize your ASPX pages for Search Engines like Google? One thing You have to do is to minimize or delete the viewstate hidden input field. Please find the solution below.

public class BasePage : Page
{
protected override void SavePageStateToPersistenceMedium(object viewState)
{
string vsKey = String.Format("VIEWSTATE_{0}_{1}_{2}", base.Session.SessionID, Request.RawUrl, DateTime.Now);
Session.Add(vsKey, viewState);
ClientScript.RegisterHiddenField("__VIEWSTATE_KEY", vsKey);
}

protected override object LoadPageStateFromPersistenceMedium()
{
string vsKey = Request.Form["__VIEWSTATE_KEY"];
return Session[vsKey];
}
}