Saturday, August 23, 2014

How to apply Loader Image in C#

Add this div in your page:
<div id="loading" style="display:none;">
 <img id="loading-image" src="images/ajax-loader.gif" alt="Loading..." />
</div>
Add this Style in your page:
<style>
#loading {
 width: 100%;
 height: 100%;
 top: 0px;
 left: 0px;
 position: fixed;
 display: block;
 opacity: 0.7;
 background-color: #fff;
 z-index: 99;
 text-align: center;
}

#loading-image {
 position: absolute;
 top: 100px;
 left: 240px;
 z-index: 100;
}
</style>


Add this line where you want to show loading image div & hide:
$('#loading').show();

$('#loading').hide();

C# Datetime Format Examples

DateTime _datetime = DateTime.Now;
String dateFormat="";

// 07/21/2007
dateFormat = _datetime.ToString("MM/dd/yyyy");
// Saturday, 21 July 2007
dateFormat = _datetime.ToString("dddd, dd MMMM yyyy");
// Saturday, 21 July 2007 14:58
dateFormat = _datetime.ToString("dddd, dd MMMM yyyy HH:mm");
// Saturday, 21 July 2007 03:00 PM
dateFormat = _datetime.ToString("dddd, dd MMMM yyyy hh:mm tt");
// Saturday, 21 July 2007 5:01 
dateFormat = _datetime.ToString("dddd, dd MMMM yyyy H:mm");
// Saturday, 21 July 2007 3:03 PM
dateFormat = _datetime.ToString("dddd, dd MMMM yyyy h:mm tt");
// Saturday, 21 July 2007 15:04:10
dateFormat = _datetime.ToString("dddd, dd MMMM yyyy HH:mm:ss");
// 07/21/2007 15:05
dateFormat = _datetime.ToString("MM/dd/yyyy HH:mm");
// 07/21/2007 03:06 PM
dateFormat = _datetime.ToString("MM/dd/yyyy hh:mm tt");
// 07/21/2007 15:07
dateFormat = _datetime.ToString("MM/dd/yyyy H:mm");
// 07/21/2007 3:07 PM
dateFormat = _datetime.ToString("MM/dd/yyyy h:mm tt");
// 07/21/2007 15:09:29
dateFormat = _datetime.ToString("MM/dd/yyyy HH:mm:ss");
// July 21
dateFormat = _datetime.ToString("MMMM dd");
// 2007-07-21T15:11:19.1250000+05:30
dateFormat = _datetime.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK");
// Sat, 21 Jul 2007 15:12:16 GMT
dateFormat = _datetime.ToString("ddd, dd MMM yyyy HH':'mm':'ss 'GMT'");
// 2007-07-21T15:12:57
dateFormat = _datetime.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss");
// 15:14
dateFormat = _datetime.ToString("HH:mm");
// 03:14 PM
dateFormat = _datetime.ToString("hh:mm tt");
// 5:15
dateFormat = _datetime.ToString("H:mm");
// 3:16 PM
dateFormat = _datetime.ToString("h:mm tt");
// 15:16:29
dateFormat = _datetime.ToString("HH:mm:ss");
// 2007-07-21 15:17:20Z
dateFormat = _datetime.ToString("yyyy'-'MM'-'dd HH':'mm':'ss'Z'");
// Saturday, 21 July 2007 15:17:58
dateFormat = _datetime.ToString("dddd, dd MMMM yyyy HH:mm:ss");
// 2007 July
dateFormat = _datetime.ToString("yyyy MMMM");