BiDirectional Sorting

Discussion in 'ASP .Net Datagrid Control' started by Sean, Feb 5, 2004.

  1. Sean

    Sean Guest

    Hi,

    I have a datagrid, which gets populated using a Stored Procedure

    I am using the standard sort comman
    Sub dg_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dgPriceList.SortComman
    Tr
    BindData(e.SortExpression
    Catch ex As Exceptio
    lberror.Text = ex.Message & "<br>" & ex.Source & "<br>" & ex.StackTrac
    End Tr
    End Su

    The regular sort works perfectly, is there a way i can get to do a bi-directional sor

    I did go thru' the list and there was a link (http://www.v4cnet.com/) and also an snippet of code, but it was not able to recognize the e.sortexpression.tostring() + "Desc

    if(SortExpression==e.SortExpression.ToString()) //Change the sort order to DES

    SortExpression = e.SortExpression.ToString() +" DESC"

    else //Change the sort order to AS

    SortExpression = e.SortExpression.ToString()

    tr

    //Bind the Grid Dat
    BindGridData()

    catch(Exception ex

    throw ex


    So, what i would like to know, if there is someway, i could get a bi-directional sort

    Thank yo
     
    Sean, Feb 5, 2004
    #1
    1. Advertising

  2. Sean

    Scott Guest

    Sean, check out this article:
    http://aspnet.4guysfromrolla.com/articles/012903-1.aspx

    It discusses how to implement bidirectional DataGrid sorting. There
    is a live demo available at:
    http://aspnet.4guysfromrolla.com/demos/dgExample27.aspx

    "Sean" <> wrote in message news:<>...
    > Hi,
    >
    > I have a datagrid, which gets populated using a Stored Procedure.
    >
    > I am using the standard sort command
    > Sub dg_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dgPriceList.SortCommand
    > Try
    > BindData(e.SortExpression)
    > Catch ex As Exception
    > lberror.Text = ex.Message & "<br>" & ex.Source & "<br>" & ex.StackTrace
    > End Try
    > End Sub
    >
    > The regular sort works perfectly, is there a way i can get to do a bi-directional sort
    >
    > I did go thru' the list and there was a link (http://www.v4cnet.com/) and also an snippet of code, but it was not able to recognize the e.sortexpression.tostring() + "Desc"
    >
    > if(SortExpression==e.SortExpression.ToString()) //Change the sort order to DESC
    > {
    > SortExpression = e.SortExpression.ToString() +" DESC";
    > }
    > else //Change the sort order to ASC
    > {
    > SortExpression = e.SortExpression.ToString();
    > }
    > try
    > {
    > //Bind the Grid Data
    > BindGridData();
    > }
    > catch(Exception ex)
    > {
    > throw ex;
    > }
    >
    >
    > So, what i would like to know, if there is someway, i could get a bi-directional sort.
    >
    > Thank you
     
    Scott, Feb 6, 2004
    #2
    1. Advertising

  3. Sean

    Sean Guest

    Thank You.

    The article and example, helped in directing me in the right path
     
    Sean, Feb 10, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    1
    Views:
    340
    Billy Porter
    Aug 12, 2003
  2. Snig
    Replies:
    2
    Views:
    455
    Infant Newbie
    Nov 27, 2003
  3. mark

    datagrid bidirectional sorting

    mark, Jun 15, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,980
    Ashish M Bhonkiya
    Jun 15, 2004
  4. Manfred Balik
    Replies:
    12
    Views:
    6,605
    Marc Guardiani
    Sep 10, 2006
  5. Snig

    DataGrid Sorting - bidirectional

    Snig, Nov 27, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    164
    Prodip Saha
    Jan 5, 2004
Loading...

Share This Page