Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Is there anyway to prevent ObjectDataSource query the database when the page opens?

Reply
Thread Tools

Is there anyway to prevent ObjectDataSource query the database when the page opens?

 
 
Max2006
Guest
Posts: n/a
 
      07-25-2007
Hi,

I have a search result GridView bound to an ObjectDataSource. Once I open
the asp.net page, the ObjectDataSource automatically refreshes the GridView
which is the default behavior.

I am trying to disable automatic query feature in ObjectDataSource, such
that it query the database only when the user click on Search button.

Is there anyway to prevent ObjectDataSource query the database when the page
opens?

Thank you,
Max



 
Reply With Quote
 
 
 
 
David Wier
Guest
Posts: n/a
 
      07-25-2007
Try removing the ObjectDataSource from the scenario altogether -
then, with the button's click event, add:
Gridview1.DataSource=(YourClass.Yourmethod)
Gridview1.Databind

Remember, though, in removing the DatasourceID from the Gridview, DO NOT let
it refresh the schema - it will remove all your fields and formatting,
giving you the default look and feel.

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://iWritePro.com



"Max2006" <> wrote in message
news:e$...
> Hi,
>
> I have a search result GridView bound to an ObjectDataSource. Once I open
> the asp.net page, the ObjectDataSource automatically refreshes the
> GridView which is the default behavior.
>
> I am trying to disable automatic query feature in ObjectDataSource, such
> that it query the database only when the user click on Search button.
>
> Is there anyway to prevent ObjectDataSource query the database when the
> page opens?
>
> Thank you,
> Max
>
>
>



 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      07-26-2007
Hi Max,

My colleague Steven and WenYuan happen to have answered similar questions,
would you please check if the solution there helps? Thanks.

# 2.0 controlling Databinding - microsoft.public.dotnet.framework.aspnet
http://groups.google.com/group/micro...rk.aspnet/brow
se_thread/thread/b44e282bb0b0f95f

# GridView databinding - microsoft.public.dotnet.framework.adonet
http://groups.google.com/group/micro...rk.adonet/brow
se_thread/thread/c077e9c12dc1b9e3


Regards,
Walter Wang (, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      07-31-2007
Hi Max,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help.


Regards,
Walter Wang (, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
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
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
ObjectDataSource method as another ObjectDataSource David Thielen ASP .Net Web Controls 3 03-23-2006 01:50 AM
HOWTO: display database without refresh web page to query database =?Utf-8?B?U1M=?= ASP .Net 3 05-15-2005 08:22 PM
Anyway to prevent IP Spoofing with Web Email? Tony A+ Certification 1 03-04-2004 12:33 PM



Advertisments