Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > PageIndexChanged

Reply
Thread Tools

PageIndexChanged

 
 
Kalmár Gábor
Guest
Posts: n/a
 
      01-21-2005
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


 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      01-21-2005
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
http://www.velocityreviews.com/forums/(E-Mail Removed)

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

 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      01-21-2005
....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" <(E-Mail Removed)> wrote in message
news:051f01c4ffc7$14751a10$(E-Mail Removed)...
> 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 Removed)
>
>>-----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
>>
>>
>>.
>>



 
Reply With Quote
 
Kalmár Gábor
Guest
Posts: n/a
 
      01-21-2005
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." <(E-Mail Removed)> wrote in message
news:eerbSn8$(E-Mail Removed)...
> ...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" <(E-Mail Removed)> wrote in message
> news:051f01c4ffc7$14751a10$(E-Mail Removed)...
>> 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 Removed)
>>
>>>-----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
>>>
>>>
>>>.
>>>

>
>



 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      01-22-2005
I wouldn't add any code to Page_Init at all, move that code to Page_Load.


"Kalmár Gábor" <(E-Mail Removed)> wrote in message
news:ebut0g9$(E-Mail Removed)...
> 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." <(E-Mail Removed)> wrote in message
> news:eerbSn8$(E-Mail Removed)...
>> ...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" <(E-Mail Removed)> wrote in message
>> news:051f01c4ffc7$14751a10$(E-Mail Removed)...
>>> 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 Removed)
>>>
>>>>-----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
>>>>
>>>>
>>>>.
>>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PageIndexChanged not firing in DataGrid Rick Strahl [MVP] ASP .Net 4 08-11-2009 07:38 AM
How to call a cached session in PageIndexChanged event? JenHu ASP .Net 0 10-28-2004 02:55 PM
Detecting a datagrid pageIndexChanged event in page_load =?Utf-8?B?TWlrZUc=?= ASP .Net 0 06-18-2004 12:08 PM
PageIndexChanged Intermittently not working?? Rubble ASP .Net 3 03-05-2004 09:16 PM
DataGrid's PageIndexChanged Not Firing for 1st (First) Page Only!!!??? Will McKee ASP .Net 0 02-23-2004 02:57 PM



Advertisments