Sort By Start Date

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ray S via .NET 247

    Sort By Start Date

    Hi,
    I am trying to sort articles based on Start Date. Since we areusing Content Management Server I have to use ChannelItem class(and so ChannelItem.Sta rtDate property). Earlier we were usingChannelIte m.SortOrdinal property to sort by Ordinal value. Hereis the code for that-

    protected void SortItems() {
    try {
    // Retrieve the channel.
    _thisChannel = GetCurrentChann el();
    // Retrieve each form element corresponding to postings in thechannel.
    ChannelAndPosti ngCollection colItems = _thisChannel.Al lChildren;
    int numItems = colItems.Count;
    string itemGuid;
    HierarchyItem currItem;
    ChannelItem currChannelItem ;
    Posting p = CMSHelper.GetCh annelProperties Posting(_thisCh annel);
    for (int i = 0 ; i < numItems; i++) {
    itemGuid = Request.Form[Convert.ToStrin g(i,Thread.Curr entThread.Curre ntCulture)];
    if (itemGuid != null) {
    currItem = CmsHttpContext. Current.Searche s.GetByGuid(ite mGuid);
    if ((currItem != null) && (currItem is ChannelItem) &&(currItem.Can SetProperties)) {
    currChannelItem = (ChannelItem)cu rrItem;
    currChannelItem .SortOrdinal = numItems - i - 1;
    }
    }
    }
    Can anyone help me with this please. Even if you can guide me tosort by Start Date will help.
    Thank you.
    -------------------------------
    From: Ray S

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>ia7KB+e/JEaht2BsLmWH1w= =</Id>
Working...