469,920 Members | 2,384 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

Disable objectdatasource-control

Hi,

I have a search page with a textbox, button, gridview and a
objectdatasource. It works great with one problem. When the page loads the
first time the objectdatasource 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 3002
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**************@TK2MSFTNGP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasource. It works great with one problem. When the page loads the
first time the objectdatasource 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****************@TK2MSFTNGP04.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**************@TK2MSFTNGP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasource. It works great with one problem. When the page loads
the first time the objectdatasource 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**************@TK2MSFTNGP03.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****************@TK2MSFTNGP04.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**************@TK2MSFTNGP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasource. It works great with one problem. When the page loads
the first time the objectdatasource 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**************@TK2MSFTNGP04.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**************@TK2MSFTNGP03.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****************@TK2MSFTNGP04.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**************@TK2MSFTNGP03.phx.gbl...
Hi,

I have a search page with a textbox, button, gridview and a
objectdatasource. It works great with one problem. When the page loads
the first time the objectdatasource 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.Datasource = nothing
end if

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

Cor
Apr 10 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by ber.janssens | last post: by
reply views Thread by Eiriken | last post: by
1 post views Thread by Jürgen Bayer | last post: by
reply views Thread by =?Utf-8?B?RGVuaXMgU29oZXQ=?= | last post: by
reply views Thread by Phillip Ian | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.