PageIndexChanged

Discussion in 'ASP .Net Datagrid Control' started by Kalmár Gábor, Jan 21, 2005.

  1. Hi!

    I try to use a datagrid control with EnableViewState=false.
    If i bind data in Page_init, all works fine except events.
    No evets fired at all. (PageIndexChanged,SortCommand)

    Why?

    thanks,
    Gabor
     
    Kalmár Gábor, Jan 21, 2005
    #1
    1. Advertising

  2. Kalmár Gábor

    Elton Wang Guest

    When postback the parameters of the datagrid are saved in
    ViewState. Once you disable the viewstate, no data about
    the datagrid can ne received in server. So how does server
    know to fire event.

    Don't set EnableViewState to false if you want to handle
    events.

    Elton Wang


    >-----Original Message-----
    >Hi!
    >
    >I try to use a datagrid control with

    EnableViewState=false.
    >If i bind data in Page_init, all works fine except events.
    >No evets fired at all. (PageIndexChanged,SortCommand)
    >
    >Why?
    >
    >thanks,
    >Gabor
    >
    >
    >.
    >
     
    Elton Wang, Jan 21, 2005
    #2
    1. Advertising

  3. Kalmár Gábor

    Scott M. Guest

    ....And don't use Page_Init for the initialization of your page controls, use
    Page_Load instead since most page controls don't even exist yet in
    Page_Init.


    "Elton Wang" <> wrote in message
    news:051f01c4ffc7$14751a10$...
    > When postback the parameters of the datagrid are saved in
    > ViewState. Once you disable the viewstate, no data about
    > the datagrid can ne received in server. So how does server
    > know to fire event.
    >
    > Don't set EnableViewState to false if you want to handle
    > events.
    >
    > Elton Wang
    >
    >
    >>-----Original Message-----
    >>Hi!
    >>
    >>I try to use a datagrid control with

    > EnableViewState=false.
    >>If i bind data in Page_init, all works fine except events.
    >>No evets fired at all. (PageIndexChanged,SortCommand)
    >>
    >>Why?
    >>
    >>thanks,
    >>Gabor
    >>
    >>
    >>.
    >>
     
    Scott M., Jan 21, 2005
    #3
  4. Hi!

    THX, for your response, i solved the problem.

    1. Convert columns to templates instead of databinding them
    2. In Page_Init, restore the original data tu th dg.dataset
    3. In each page_load, rebind the datasrc

    Then the events fires again.

    G.

    "Scott M." <> wrote in message
    news:eerbSn8$...
    > ...And don't use Page_Init for the initialization of your page controls,
    > use Page_Load instead since most page controls don't even exist yet in
    > Page_Init.
    >
    >
    > "Elton Wang" <> wrote in message
    > news:051f01c4ffc7$14751a10$...
    >> When postback the parameters of the datagrid are saved in
    >> ViewState. Once you disable the viewstate, no data about
    >> the datagrid can ne received in server. So how does server
    >> know to fire event.
    >>
    >> Don't set EnableViewState to false if you want to handle
    >> events.
    >>
    >> Elton Wang
    >>
    >>
    >>>-----Original Message-----
    >>>Hi!
    >>>
    >>>I try to use a datagrid control with

    >> EnableViewState=false.
    >>>If i bind data in Page_init, all works fine except events.
    >>>No evets fired at all. (PageIndexChanged,SortCommand)
    >>>
    >>>Why?
    >>>
    >>>thanks,
    >>>Gabor
    >>>
    >>>
    >>>.
    >>>

    >
    >
     
    Kalmár Gábor, Jan 21, 2005
    #4
  5. Kalmár Gábor

    Scott M. Guest

    I wouldn't add any code to Page_Init at all, move that code to Page_Load.


    "Kalmár Gábor" <> wrote in message
    news:ebut0g9$...
    > Hi!
    >
    > THX, for your response, i solved the problem.
    >
    > 1. Convert columns to templates instead of databinding them
    > 2. In Page_Init, restore the original data tu th dg.dataset
    > 3. In each page_load, rebind the datasrc
    >
    > Then the events fires again.
    >
    > G.
    >
    > "Scott M." <> wrote in message
    > news:eerbSn8$...
    >> ...And don't use Page_Init for the initialization of your page controls,
    >> use Page_Load instead since most page controls don't even exist yet in
    >> Page_Init.
    >>
    >>
    >> "Elton Wang" <> wrote in message
    >> news:051f01c4ffc7$14751a10$...
    >>> When postback the parameters of the datagrid are saved in
    >>> ViewState. Once you disable the viewstate, no data about
    >>> the datagrid can ne received in server. So how does server
    >>> know to fire event.
    >>>
    >>> Don't set EnableViewState to false if you want to handle
    >>> events.
    >>>
    >>> Elton Wang
    >>>
    >>>
    >>>>-----Original Message-----
    >>>>Hi!
    >>>>
    >>>>I try to use a datagrid control with
    >>> EnableViewState=false.
    >>>>If i bind data in Page_init, all works fine except events.
    >>>>No evets fired at all. (PageIndexChanged,SortCommand)
    >>>>
    >>>>Why?
    >>>>
    >>>>thanks,
    >>>>Gabor
    >>>>
    >>>>
    >>>>.
    >>>>

    >>
    >>

    >
    >
     
    Scott M., Jan 22, 2005
    #5
    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. Rick Strahl [MVP]

    PageIndexChanged not firing in DataGrid

    Rick Strahl [MVP], Nov 21, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    6,075
    rohit.shrivastava04@gmail
    Aug 11, 2009
  2. Rubble
    Replies:
    3
    Views:
    734
    Alvin Bruney [MVP]
    Mar 5, 2004
  3. Will McKee
    Replies:
    0
    Views:
    2,361
    Will McKee
    Feb 23, 2004
  4. =?Utf-8?B?TWlrZUc=?=
    Replies:
    0
    Views:
    513
    =?Utf-8?B?TWlrZUc=?=
    Jun 18, 2004
  5. JenHu
    Replies:
    0
    Views:
    560
    JenHu
    Oct 28, 2004
Loading...

Share This Page