Disable objectdatasource-control

  • Thread starter Thread starter Michael Fällgreen
  • Start date Start date
M

Michael Fällgreen

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
 
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,

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
 
2.0

Michael
Cor Ligthert said:
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,

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
 
Back
Top