Sort in datagrid

Results 1 to 2 of 2

Thread: Sort in datagrid

  1. #1
    Join Date
    Dec 1969

    Default Sort in datagrid

    I have a sort function allows click on a button and set the sort column name to viewstate, but fist click wouldn't get the value, so the sort is always display the previous selected column, can someone tell me why??? Please!!!

  2. #2
    Join Date
    Dec 1969

    Default RE: Sort in datagrid

    I am just guessing here but sounds like that when you click the button you run to the server and set the column to be sorted into the view state. Whats happening is first the server checks on postback any values in viewstate that are different than last trip to server.... it notices that the sortfield in viewstate has changed fromlast run to server and causes the grid to resort. Next it takes the button event and changes your value in the viewstate for sorting to the new value the button handler gives it.... boom now your all set so next trip to the server you can sort based on that value.... your always one trip behind on your sorting. I think this is because viewstate is loaded and and updated before the button click event is handled... somewhere I saw an article about the order of a postback request... I think postback data is compared to viewstate and any changes fires the handler before other events are handled.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts