Allen Buckley's Blog
My experiences in .Net

September 2009 Entries

Report Parameter Working for one Report, but not Another

We have several MS Reporting Service Reports at my company that were using a parameter that I’ll call “Person”. We display the reports on our ASP.NET Website and when a report is selected that needs the Person parameter we show a Person DropDownList. For some reason this was working fine on several reports, but not for a new report. We verified through the Reporting Service interface and by looking at the actual parameter data in the database that everything looked correct. The Person parameter for...

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Common Issues found when Refactoring

I’ve been doing a lot of refactoring lately and I’ve decided to list out a couple of common issues I found with code that I’ve come across in several projects I have worked on. One of the most common themes I’ve seen in ASP.NET projects is Business logic code in the Click Events. It is really frustrating to see several hundreds of lines in one Event. Please do not put ANY Business logic and especially no Data Access code in there! There are several reasons why, but the biggest reason I have come...

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

DropDownList Sort using LINQ

I needed to do a quick sort on a DropDownList Server Control and found a great way of doing it in just 4 lines of code. Your project will need to be pointed to the .NET 3.5 Framework and will need a reference to System.Linq. List<string> list = DropDownList.Items.Cast<... => item.Text).ToList(); list.Sort((x, y) => string.Compare(x, y)); DropDownList.DataSource = list; DropDownList.DataBind();

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati