Hi and welcome to my blog. Im Tasos, a software engineer working in the UK. This is where i share some of my findings related with SQL, c#, asp.net and javascript with you. I hope you find something helpful and Im looking forward to your feedback!

Recent Comments

Popular Posts

Recent Posts

Archives

Post Categories

Blog Stats

  • Posts: 15
  • Comments: 116
  • Trackbacks: 9
  • Articles: 1

ASP.Net

Yield return and Iterators use case: looping through the days between a date span

posted @ Thursday, November 15, 2007 11:54 PM | Feedback (1), Filed Under ASP.Net C#

I recently found myself in the situation where I had to loop through all the days from a StartDate to an EndDate. Sure easy, all you need to do is something like this: DateTime startDate = DateTime.Now; DateTime endDate = DateTime.Now.AddDays(3); DateTime curDate = startDate; while (curDate <= endDate) { //Do Something with curDate ... curDate = curDate.AddDays(1); } Does the job, but it is not very intuitive in my opinion. It is not that easy to read. Wouldn't it be so much nicer if we could do something like this: DayIterator dayIterator =...

Making your ASP:Repeater a little bit DRYer

posted @ Thursday, November 08, 2007 10:14 PM | Feedback (4), Filed Under ASP.Net

Dont Repeat Yourself, we see it all over, but yet the suggested way of doing things with a Repeater control makes many developers repeat code. Let me explain what I mean, say we want to use a repeater to render a table containing rows of alternating colors. Sure there is a GridView for this, but there are some cases when we would like to use the more lightweight repeater (especially if we just want a readonly representation and do not want editing capabilities) As you already know, alternating rows in the...