Saturday, October 27, 2012

How to center align horizontal

HTML

<div id="horizontal-menu">
      <ul>
            <li><a href='#'>Link 1</a></li>
            <li><a href='#'>Link 2</a></li>
            <li><a href='#'>Link 3</a></li>
            <li><a href='#'>Link 4</a></li>
      </ul>
</div>

CSS

<style type="text/css">
    .footer-menu { position: relative; left: -50%; float: right; }
    .footer-menu ul { position: relative; left: 50%; }
    .footer-menu ul li { display: block; float: left; position: relative; }
    .footer-menu ul li a { display: block; white-space: nowrap; }
</style>

 That's all folks

Saturday, July 14, 2012

join Name Value Collection Keys and values asp dot net

NameValueCollection nvc = new NameValueCollection(); 
//Fill collection
string sql=""; 

sql = "INSERT INTO [TABLENAME]";

//Join all keys with ],[ as seperator
sql += string.Format(" ([{0}])", string.Join("],[", nvc.AllKeys));
//Join all values with ',' as seperator 
sql += string.Format(" VALUES('{0}')", string.Join("','", nvc.AllKeys.Select(key => nvc[key]))); 
 
 

Converting byte[] to string in asp dot net c#

string str = System.Text.Encoding.UTF8.GetString( byte[] arr );

Monday, July 9, 2012

HTML5 equivalent of cellpadding, cellspacing, valign, and align?

/*cellpadding*/
th, td { padding: 0; }
 
/* cellspacing */
table { border-collapse:separate; border-spacing: 0; }
 
/* valign */
th, td { vertical-align: top|middle|bottom; }
 
/* align (center)
   width of table must be less than the parent container */
table { margin: 0 auto; }