PageIndexChanged

K

Kalmár Gábor

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
 
E

Elton Wang

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
(e-mail address removed)
 
S

Scott M.

....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.
 
K

Kalmár Gábor

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top