Hello,
I have created an Export to Excel class that properly formats the columns based on the property data type of the list item.
My problem is I would like to use the ExportToExcel as a generic method that I can call from any page, and pass a business object derived from ReadOnlyListBase. So for example, on a page called People which has a gridview bound to PeopleList, I have a button click event wired up like this:
protected void ExportToExcel_Click(object sender, EventArgs e)
{
PeopleList list = this.GetPeopleList();
ExportHelper.ExportToExcel(list, fileName);
}
and in my ExportHelper class I have a method like this:
public static void ExportToExcel(object list, string filename)
problem is I would like list to be of type ReadOnlyListBase, so that when I call the method from People page or Animal page or Plant page and pass the associated <xyz>List, I can iterate thru the collection, get the property data type.
I'd greatly appreciate any help.
Andrew
What you really want is probably to have the list parameter be a basic enumerable or collection type. Options include IEnumerable, IList and probably ICollection. That'll get you not only CSLA list types, but most list types in all of .NET.
Hey Andrew
Can you share your Export to Excel Class, I was looking for such an option for my CSLA lists.
Thanks,
Zak
Copyright (c) Marimer LLC