473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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

Jul 25 '07 #1
3 2804
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" <al*******@newsgroup.nospamwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
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

Jul 25 '07 #2
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 (wa****@online.microsoft.com, 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.

Jul 26 '07 #3
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 (wa****@online.microsoft.com, 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.

Jul 31 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Anne Catterick | last post by:
Hi, I have an british ASP.Net 2.0 application which is doing what (should) be very simple. But I am having issues. On my page I have a GridView as follows (some tags excluded for easy...
1
by: Felix_WafyTech | last post by:
Hi, I'm working with the ObjectDatasource and the application is getting more and more chatty. Is there a way I could make the ObjectDatasource support multiple DataTables that could be...
2
by: J055 | last post by:
Hi I've implemented caching for my ObjectDataSource. <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnableCaching="True" CacheDuration="10" CacheExpirationPolicy="Sliding" ...
2
by: planetthoughtful | last post by:
Hi All, I have an ASP.NET page that displays a GridView control based on an ObjectDataSource control. I'm wondering if it's possible to base the ObjectDataSource in question on a parameter...
10
by: J055 | last post by:
Hi I've been trying out SqlCacheDependency using the ObjectDataSource and SQL Server 2005. It all works quite well with the minimum of configuration, e.g. <asp:ObjectDataSource...
1
by: Raja | last post by:
Hi everybody I am converting my pages to use ObjectDataSource instead of SqlDataSource and want to keep the same user interface but have a small problem. In a page using SqlDataSource I have a...
0
by: =?Utf-8?B?RGVuaXMgU29oZXQ=?= | last post by:
Hi all, I've created a new project to test ObjectDataSource component. I've just added a new objectdatasource, configured it (linked to a table) etc ... It works fine on localhost, i can...
1
by: Nightcrawler | last post by:
I am using the ObjectDataSource to bind to a DropDownList. I have enabled the cache on the ObjectDataSource since the data it is selecting will most likely not chage in the near future (countries)....
0
by: mesut | last post by:
Hi there, when you put a objectdatasource control and set the selectmethod in the page the grid is filled immediatly after page loads. Is there a way to fill the grid from the code-behind C#...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.