Sorting an ObjectDataSource with child Classes
I found a really good article that tells what needs to be done to create a custom comparer that will allow objects to be sorted. That's about all there is to it... but it's really good.
Here's the link.
Storage for things I want to keep handy for future reference.
I found a really good article that tells what needs to be done to create a custom comparer that will allow objects to be sorted. That's about all there is to it... but it's really good.
4guysfromrolla.com is where I end up much of the time after searching for how to do something in ASP. They have some really great information on that site. One item in particular that I thought was cool is thee fact that you can set the page title dynamically with information contained in the site map control. Read the article to be enlightened.

private void MoveListBoxItem(string direction)
{
switch (direction)
{
case "up":
if (productSectionBindingSource.Position!=0)
{
int OriginalIndex = productSectionBindingSource.Position;
ProductSection SectionToMove = productSectionBindingSource.Current as ProductSection;
SectionToMove.DisplayOrder = OriginalIndex - 1;
productSectionBindingSource.Remove(SectionToMove);
productSectionBindingSource.Insert(OriginalIndex - 1, SectionToMove);
productSectionBindingSource.Position = OriginalIndex;
(productSectionBindingSource.Current as ProductSection).DisplayOrder = OriginalIndex;
productSectionBindingSource.Position = OriginalIndex - 1;
}
break;
case "down":
if (productSectionBindingSource.Position != productSectionListBox.Items.Count - 1)
{
int OriginalIndex = productSectionBindingSource.Position;
ProductSection SectionToMove = productSectionBindingSource.Current as ProductSection;
SectionToMove.DisplayOrder = OriginalIndex + 1;
productSectionBindingSource.Remove(SectionToMove);
productSectionBindingSource.Insert(OriginalIndex + 1, SectionToMove);
productSectionBindingSource.Position = OriginalIndex;
(productSectionBindingSource.Current as ProductSection).DisplayOrder = OriginalIndex;
productSectionBindingSource.Position = OriginalIndex + 1;
}
break;
default:
break; }
}
After being given the task of making one of our application databases be the source of a public folder contact list in Outlook, I came to find that the task is not as easy as it may seem. There are about a billion different ways to do it and you can see some of them here. The one that was decided to be the best for our purposes was Stephen Toub's Outlook Contact Provider. After implementing some caching on the project, it did exactly what we needed and it works great. This basically mimics a SharePoint web service and uses a custom provider to get the contacts from a database. I ran into a little trouble because of the conversion to ASP.NET 2.0 but after those issues were resolved, it worked like a charm.