Setting SortInfo dynamically

  1. #1

    Setting SortInfo dynamically

    I'm trying to set the SortInfo in code behind (C#). I expected to be able to set it like this:

    
    
    
    
    this.Store1.SortInfo = new SortInfo("MyColumn", Coolite.Ext.Web.SortDirection.DESC);
    but that isn't working. I did search for a while, but I've still only seen it set in aspx.
  2. #2

    RE: Setting SortInfo dynamically

    Hi,

    Try

    
    Store1.SortInfo.Field = "MyColumn";
    
    Store1.SortInfo.Direction = SortDirection.DESC;
    Wtower

  3. #3

    RE: Setting SortInfo dynamically

    That gave me an error that the "Object reference not set to an instance of an object". I did not have the SortInfo on my aspx page. I added it to the aspx and it does run successfully. Ideally, I'd prefer to not have to set it on the aspx page and then override it on Page_Load. That being said, it works!!! There's something to be said for that.

    Thanks.
  4. #4

    RE: Setting SortInfo dynamically

    Hi,

    this.Store1.SortInfo = new SortInfo("MyColumn", Coolite.Ext.Web.SortDirection.DESC);

    should works.


    Please note that it works during initial Page Load. During AjaxEvent you need to use
    Store1.Sort("MyColumn", Coolite.Ext.Web.SortDirection.DESC);
  5. #5

    RE: Setting SortInfo dynamically

    It was being called during an ajax event. That was the issue. I used the code you gave for an ajax event and it worked perfectly. Thanks!

Similar Threads

  1. Replies: 1
    Last Post: Nov 24, 2011, 6:13 PM
  2. Replies: 4
    Last Post: Jul 26, 2011, 8:17 AM
  3. Store.OnRefreshData and SortInfo
    By Awrong in forum 1.x Help
    Replies: 1
    Last Post: Dec 30, 2009, 6:04 AM
  4. Error when setting store.SortInfo in codebehind
    By plykkegaard in forum 1.x Help
    Replies: 0
    Last Post: May 19, 2009, 4:57 PM
  5. [CLOSED] SortInfo tag in Store
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 17, 2008, 7:39 AM

Posting Permissions