473,750 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi,

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

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

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

Thank you,
Max

Jul 25 '07 #1
3 2821
Try removing the ObjectDataSourc e from the scenario altogether -
then, with the button's click event, add:
Gridview1.DataS ource=(YourClas s.Yourmethod)
Gridview1.Datab ind

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*******@news group.nospamwro te in message
news:e$******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

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

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

Is there anyway to prevent ObjectDataSourc e 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.publi c.dotnet.framew ork.aspnet
http://groups.google.com/group/micro...rk.aspnet/brow
se_thread/thread/b44e282bb0b0f95 f

# GridView databinding - microsoft.publi c.dotnet.framew ork.adonet
http://groups.google.com/group/micro...rk.adonet/brow
se_thread/thread/c077e9c12dc1b9e 3
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
8503
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 reading): <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" DataKeyNames="Id" OnRowUpdated="GridView1_RowUpdated">
1
3062
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 retrieved as one Dataset? I'm wondering how others out there work with ObjectDatasource? The only option I now see to get this fixed is to manually make the call to the Web services, retrieve the Dataset and assign the datatable to the controls (Or can...
2
6269
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" SelectMethod="GetUsers" TypeName="BizObject"></asp:ObjectDataSource> This works, however I need to explicitly clear/remove the cache when I
2
12801
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 query, with the ability to set the parameter value at run time (in the Page_Load event, perhaps?)? Basically, I'd like to display records in the GridView based on values
10
4577
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 ID="odsAccounts" runat="server" ... EnableCaching="true" SqlCacheDependency="CommandNotification"> .... </asp:ObjectDataSource>
1
1479
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 textbox where user can input the query (whole query in SQL). Then by clicking the search button I was using it as: SqlDataSource1.SelectCommand = txtQuery.Text. I want to have the same interface into a converted page where I am using...
0
1649
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 create, retrieve, update and delete data.
1
2046
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). Is there a way to access this cache data on a different page? I figure if I Already have it cached why should I query the database a agin for this information if I can just cast the cache object to a DataTable and query it that way. Please...
0
931
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# with manual firing the object datasource? I mean I would like assigne object datasource to a submit button and when I click the submit button that should fire the objectdatasource and fill the grid iso automatically when page opens....
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.