Showing posts with label Sample Code. Show all posts
Showing posts with label Sample Code. Show all posts

Sunday, October 11, 2009

FREE asp:LinkButtons for download

Not being a designer myself, I understand the pains of getting the right images for my site.
Had to go through a lot of pain to get some designs for asp:LinkButtons












Sample css for the above LinkButtons:

.icon-cancel {
background: url(icons/cancel.png) no-repeat left top;
display:inline;
padding-left:1px;
margin-left: 1px;
padding-right:1px;
}


In the .aspx page for the LinkButton use the following properties:
cssclass="icon-cancel" underline="false" height="30px" width="90px"


Sharign these with you. Hope its useful.

Monday, September 14, 2009

How to get the end of month date ?

There is a common requirement to extract the end of month date from a given date.



For eg. if I have a date of "15/09/2009" (dd/mm/yyyy) I would like to know what is the last date of this month which is "30/09/2009"



Below is a simple code to do this:


DateTime dtToday = DateTime.Today;
DateTime dtEndOfMonth;
if (dtToday.Month != 12)
dtEndOfMonth = new DateTime(dtToday.Year, dtToday.Month + 1, 1).AddDays(-1);
else
dtEndOfMonth = new DateTime(dtToday.Year + 1, 1, 1).AddDays(-1);


Hope this helps !