GridView_Sorting() Event fires twice?

Discussion in 'ASP .Net Datagrid Control' started by Whitney Yiu, Jun 28, 2006.

  1. Whitney Yiu

    Whitney Yiu Guest

    I have a gridview object, and i have bound it to data. I created a sort
    method, and have set it so that when the gridview heading is clicked on, it
    should sort the gridview (the [gridview]_sorting() method fires when a
    heading is called, and then my sort method is called within there).

    My sorting works, and it is set to sort both asc or desc. But right now i am
    only getting desc. sorts because the gridview_sorting() method fires twice
    (one right after another) and i have no clue why.

    can anyone help me out, and explain what's going on here?

    any help is appreciated, thanks!

    --whit
    Whitney Yiu, Jun 28, 2006
    #1
    1. Advertising

  2. maybe because in Page_Load you bind your data... right?

    inside Page_Load you need to bind your data only is the page is not a
    postBack

    if not Page.IsPostBack then
    add here the code to bind the data into the grid
    end if

    --

    Bruno Alexandre
    (a Portuguese in KĂžbenhanv, Danmark)


    "Whitney Yiu" <> escreveu na mensagem
    news:...
    >I have a gridview object, and i have bound it to data. I created a sort
    > method, and have set it so that when the gridview heading is clicked on,
    > it
    > should sort the gridview (the [gridview]_sorting() method fires when a
    > heading is called, and then my sort method is called within there).
    >
    > My sorting works, and it is set to sort both asc or desc. But right now i
    > am
    > only getting desc. sorts because the gridview_sorting() method fires twice
    > (one right after another) and i have no clue why.
    >
    > can anyone help me out, and explain what's going on here?
    >
    > any help is appreciated, thanks!
    >
    > --whit
    Bruno Alexandre, Jun 30, 2006
    #2
    1. Advertising

  3. Whitney Yiu

    alex Guest

    I'm having the same issue.
    I'm not bind the data at page_load.
    i'm calling the databind from the sort method when it fires.
    Did you find out what the issue was?
    Thanks
    Alex

    >I have a gridview object, and i have bound it to data. I created a sort

    method, and have set it so that when the gridview heading is clicked on, it
    should sort the gridview (the [gridview]_sorting() method fires when a
    heading is called, and then my sort method is called within there).

    My sorting works, and it is set to sort both asc or desc. But right now i am
    only getting desc. sorts because the gridview_sorting() method fires twice
    (one right after another) and i have no clue why.

    can anyone help me out, and explain what's going on here?

    any help is appreciated, thanks!

    --whit


    ___
    Newsgroups brought to you courtesy of www.dotnetjohn.com
    alex, Jul 27, 2006
    #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. Bob Barrows

    Re: Page Load Event Fires Twice

    Bob Barrows, Jul 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    396
    Bob Barrows
    Jul 9, 2003
  2. Steve C. Orr, MCSD

    Re: Page Load Event Fires Twice

    Steve C. Orr, MCSD, Jul 9, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    579
    Wray Smallwood
    Jul 10, 2003
  3. Jonas Nilsson

    ItemCommand Event fires twice

    Jonas Nilsson, Aug 1, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,054
    Jonas Nilsson
    Aug 1, 2003
  4. Jon
    Replies:
    1
    Views:
    11,374
    George Ter-Saakov
    Jan 13, 2004
  5. Replies:
    3
    Views:
    994
Loading...

Share This Page