473,659 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disable objectdatasourc e-control

Hi,

I have a search page with a textbox, button, gridview and a
objectdatasourc e. It works great with one problem. When the page loads the
first time the objectdatasourc e calls the select-method and because its
bound to the textbox (search string) and the textbox is empty it display all
records. This is not the way I wnat it to work - however I want the user to
be able to make a blank search (and return all items).

Can I "disable" the datasource control on first load?

Thanks
Apr 10 '06 #1
5 3146
Michael,

There is nothing wrong with a switch if it is needed.

But in the way you tell it am I asking myself why are you binding it in the
load.
(or are you binding it by the designer, have than just a look in the
designer created code, and cut and paste that part there where you need it)

Cor
"Michael Fällgreen" <mf*@ulle.se> schreef in bericht
news:eH******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasourc e. It works great with one problem. When the page loads the
first time the objectdatasourc e calls the select-method and because its
bound to the textbox (search string) and the textbox is empty it display
all records. This is not the way I wnat it to work - however I want the
user to be able to make a blank search (and return all items).

Can I "disable" the datasource control on first load?

Thanks

Apr 10 '06 #2
Hi

Im binding in the designer! How can I "make a switch"?

Thanks
"Cor Ligthert [MVP]" <no************ @planet.nl> skrev i en meddelelse
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Michael,

There is nothing wrong with a switch if it is needed.

But in the way you tell it am I asking myself why are you binding it in
the load.
(or are you binding it by the designer, have than just a look in the
designer created code, and cut and paste that part there where you need
it)

Cor
"Michael Fällgreen" <mf*@ulle.se> schreef in bericht
news:eH******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasourc e. It works great with one problem. When the page loads
the first time the objectdatasourc e calls the select-method and because
its bound to the textbox (search string) and the textbox is empty it
display all records. This is not the way I wnat it to work - however I
want the user to be able to make a blank search (and return all items).

Can I "disable" the datasource control on first load?

Thanks


Apr 10 '06 #3
Michael,

If you are binding in the designer than the binding is done while
initializing.

What version are you using? (1.x or 2.0)

Cor

"Michael Fällgreen" <mf*@ulle.se> schreef in bericht
news:e5******** ******@TK2MSFTN GP03.phx.gbl...
Hi

Im binding in the designer! How can I "make a switch"?

Thanks
"Cor Ligthert [MVP]" <no************ @planet.nl> skrev i en meddelelse
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Michael,

There is nothing wrong with a switch if it is needed.

But in the way you tell it am I asking myself why are you binding it in
the load.
(or are you binding it by the designer, have than just a look in the
designer created code, and cut and paste that part there where you need
it)

Cor
"Michael Fällgreen" <mf*@ulle.se> schreef in bericht
news:eH******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasourc e. It works great with one problem. When the page loads
the first time the objectdatasourc e calls the select-method and because
its bound to the textbox (search string) and the textbox is empty it
display all records. This is not the way I wnat it to work - however I
want the user to be able to make a blank search (and return all items).

Can I "disable" the datasource control on first load?

Thanks



Apr 10 '06 #4
2.0

Michael
"Cor Ligthert [MVP]" <no************ @planet.nl> skrev i en meddelelse
news:ui******** ******@TK2MSFTN GP04.phx.gbl...
Michael,

If you are binding in the designer than the binding is done while
initializing.

What version are you using? (1.x or 2.0)

Cor

"Michael Fällgreen" <mf*@ulle.se> schreef in bericht
news:e5******** ******@TK2MSFTN GP03.phx.gbl...
Hi

Im binding in the designer! How can I "make a switch"?

Thanks
"Cor Ligthert [MVP]" <no************ @planet.nl> skrev i en meddelelse
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Michael,

There is nothing wrong with a switch if it is needed.

But in the way you tell it am I asking myself why are you binding it in
the load.
(or are you binding it by the designer, have than just a look in the
designer created code, and cut and paste that part there where you need
it)

Cor
"Michael Fällgreen" <mf*@ulle.se> schreef in bericht
news:eH******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasourc e. It works great with one problem. When the page loads
the first time the objectdatasourc e calls the select-method and because
its bound to the textbox (search string) and the textbox is empty it
display all records. This is not the way I wnat it to work - however I
want the user to be able to make a blank search (and return all items).

Can I "disable" the datasource control on first load?

Thanks



Apr 10 '06 #5
Michael,

GridView I was aspectiong you were using windowsforms.

In this case I would simple try in the load event

if not ispostback then
GridView1.Datas ource = nothing
end if

Not tried, I would not know why this would not work.

Cor
Apr 10 '06 #6

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

Similar topics

0
1587
by: ber.janssens | last post by:
Hi, I am trying the new ObjectDataSource from ASP.NET 2.0. I connected a Gridview with ObjectDataSource which is connected to a webservice which returns a DataSet. In the Webmethod I return only the rows for the current page because paging is enabled, I use the parameters maximumRows and startRowIndex for doing this. I also got sorting to work using the parameter sortExpression. The method of the webservice looks like this:
0
1487
by: Eiriken | last post by:
Hello everyone, I am using ASP.NET 2 and trying to bind a objectdatasource to a gridview. By doing this the most common way by adding an objectdatasource to the page and by using the wizard to connect to my business logic everything works fine. The problem is that I find this quite limited and I need to do some custom work with the parameters, so I am trying to code everything by hand in the code behind. >From a security perspective,...
1
1924
by: Jürgen Bayer | last post by:
Hi, I just tried out the ObjectDataSource of ASP.NET 2.0. A simple application works with a GridView bound to an ObjectDataSource. The ObjectDataSource is set to a (factory) class (PersonFactory) with static methods (Select, Update, Delete, see below). The factory methods work with instances of a simple class (Person, see below). Select and Update works, but the Person object passed to the Delete method is always empty (Id == 0;...
0
1884
by: Northern | last post by:
Hello, I have some trouble to declare and instantiate dynamically an ObjectDataSource in the codebehind file. The idea is to bind the objectdatasource to a gridview and have automate sorting and paging. The objectdatasource SelectMethod returns a dataview. When my objectdatasource is declared in the codebehind, sorting is not working and i receive following error when clicking on a datagrid's column header. I made the same test...
2
3916
by: J055 | last post by:
Hi I have a method with the following signature: public bool UpdateSetAccounts(int items) { } How do I pass a collection of selected values in a ListBox to this ObjectDataSource UpdateMethod? I can pass the ListItemCollection in a ControlParameter, e.g.
1
9804
by: Roger | last post by:
Hi all On a page I am using a repeater which is linked to an ObjectDataSource (same page): <asp:Repeater ID="VideoListNewestRepeater" runat="server" DataSourceID="VideoListNewestDataSource"> The code for ObjectDataSource looks like this:
0
2176
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check or clear the boxes next to the potential members they want to add or remove.) The Object Data Source is as follows... <asp:ObjectDataSource ID="odsMembers" runat="server" SelectMethod="GetGroupMembersSelectList"...
0
1636
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.
0
5515
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to code what I think is a fairly typical Master/Detail scenario with two GridViews, using AJAX. Using the Northwind sample, I have two ObjectDataSources - one which pulls data from the Orders table, and one that pulls the related data from . Each...
3
11177
by: btreddy | last post by:
Hii all, I've a problem regarding passing select parameters to objectdatasource from code behind. i would like to pass the select parameters to a objectdatasource ..not in the selecting or selected event of the objectdatasource but some where in the one of button click event. i tried of adding the parameters but it didn work for me.. <asp:ObjectDataSource ID="ODSEditSchedules" TypeName="Schedules" runat="server"...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
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...
0
7356
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
6179
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
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
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
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.