Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > button's OnClick event runs after page databinding...

Reply
Thread Tools

button's OnClick event runs after page databinding...

 
 
Daves
Guest
Posts: n/a
 
      01-13-2006
a GridView control iterates users in my database and below it there are
search fields and Search button which applies filter expression to the
SqlDataSource.

The GridView is manually databound in the Page_Load event and I also persist
this databinding since the GridView uses postback since it users paging and
sorting options. Now, if the Search button is used, it's OnClick event is
run *AFTER* the Page_Load event so if I use it, I am actually databinding
twice!

Is there some way for me to check in the Page_Load if the Search button was
used or how can I handle this situation?


 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      01-13-2006
Databind during the page_load only if not Page.IsPostBack.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"Daves" wrote:

> a GridView control iterates users in my database and below it there are
> search fields and Search button which applies filter expression to the
> SqlDataSource.
>
> The GridView is manually databound in the Page_Load event and I also persist
> this databinding since the GridView uses postback since it users paging and
> sorting options. Now, if the Search button is used, it's OnClick event is
> run *AFTER* the Page_Load event so if I use it, I am actually databinding
> twice!
>
> Is there some way for me to check in the Page_Load if the Search button was
> used or how can I handle this situation?
>
>
>

 
Reply With Quote
 
 
 
 
Daves
Guest
Posts: n/a
 
      01-13-2006
not possible because the GridView's page & sorting functions also use
PostBack!


"Phillip Williams" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Databind during the page_load only if not Page.IsPostBack.
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Daves" wrote:
>
>> a GridView control iterates users in my database and below it there are
>> search fields and Search button which applies filter expression to the
>> SqlDataSource.
>>
>> The GridView is manually databound in the Page_Load event and I also
>> persist
>> this databinding since the GridView uses postback since it users paging
>> and
>> sorting options. Now, if the Search button is used, it's OnClick event is
>> run *AFTER* the Page_Load event so if I use it, I am actually databinding
>> twice!
>>
>> Is there some way for me to check in the Page_Load if the Search button
>> was
>> used or how can I handle this situation?
>>
>>
>>



 
Reply With Quote
 
Phillip Williams
Guest
Posts: n/a
 
      01-13-2006
Try databinding during the page_PreRender stage after all other events are
processed.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"Daves" wrote:

> not possible because the GridView's page & sorting functions also use
> PostBack!
>
>
> "Phillip Williams" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Databind during the page_load only if not Page.IsPostBack.
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> >
> >
> > "Daves" wrote:
> >
> >> a GridView control iterates users in my database and below it there are
> >> search fields and Search button which applies filter expression to the
> >> SqlDataSource.
> >>
> >> The GridView is manually databound in the Page_Load event and I also
> >> persist
> >> this databinding since the GridView uses postback since it users paging
> >> and
> >> sorting options. Now, if the Search button is used, it's OnClick event is
> >> run *AFTER* the Page_Load event so if I use it, I am actually databinding
> >> twice!
> >>
> >> Is there some way for me to check in the Page_Load if the Search button
> >> was
> >> used or how can I handle this situation?
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Keith Patrick
Guest
Posts: n/a
 
      01-16-2006
The gridview should be storing the data it retrieved in its viewstate and
restore the control's state (and that of its rows) on postback without the
need to databind. Are you saying that paging/sorting is somehow interfering
with that process for you?


 
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
onclick runs straight away.... windandwaves Javascript 2 02-20-2006 09:17 AM
how to handle both onmouseup event and onClick event JerryG ASP .Net 0 12-20-2005 03:49 AM
SelectedIndex changed after onclick event Cathryn Johns ASP .Net Datagrid Control 0 10-28-2005 02:53 PM
How to display a html page after the original html page runs a perl script Stu HTML 2 04-06-2004 05:19 AM
After onclick code runs, open new window, close self? Kathy Burke ASP .Net 2 10-15-2003 11:12 PM



Advertisments