Prevent gridview retrieve on page load

G

Guest

Hi,

I have a form with textboxes, a search button and a gridview. The textboxes
are filled with default values so that the gridview should return all rows
but not before the user has had the chance to change some of the textboxes
and has clicked the search button.
How can I avoid the gridview displaying all rows before the search button
was clicked?
Any Ideas? Thanks
Diane
 
G

Guest

Thanks Eliyahu for your answer. I'm new in ASP(.net) probably that's why it
is not yet fully clear to me how to control databinding. I use an
objectdatasource with a tableadapter to populate my gridview. I presume this
is an 'automated' databind? How can I prevent it and trigger the databinding
when the search button is clicked?
--
Thanks
Diane


Eliyahu Goldin said:
Diane,

A gridview displays its content. If there is no content, there is nothing to
display. In most scenarios a gridview gets populated as a result of
databinding. Probably, you are calling DataBind method for the gridview or
for the page. In the latter case, replace a DataBind call for the page with
DataBind calls to specific components that need databinding. And call
DataBind for the grid in the event handler for the search button.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Diane Truyens said:
Hi,

I have a form with textboxes, a search button and a gridview. The
textboxes
are filled with default values so that the gridview should return all rows
but not before the user has had the chance to change some of the textboxes
and has clicked the search button.
How can I avoid the gridview displaying all rows before the search button
was clicked?
Any Ideas? Thanks
Diane
 
E

Eliyahu Goldin

Diane,

A gridview displays its content. If there is no content, there is nothing to
display. In most scenarios a gridview gets populated as a result of
databinding. Probably, you are calling DataBind method for the gridview or
for the page. In the latter case, replace a DataBind call for the page with
DataBind calls to specific components that need databinding. And call
DataBind for the grid in the event handler for the search button.
 
G

Guest

Sorry, but I can't see where to set the Datasource property.
When I click on my gridview I see a DataSourceID property but no DataSource
property.
--
Diane


Eliyahu Goldin said:
I think, if you use DataSourceID property, the databinding will take place
automatically as your set the property. Instead use DataSource property.
Than you will have to call DataBind manually.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Diane Truyens said:
Thanks Eliyahu for your answer. I'm new in ASP(.net) probably that's why
it
is not yet fully clear to me how to control databinding. I use an
objectdatasource with a tableadapter to populate my gridview. I presume
this
is an 'automated' databind? How can I prevent it and trigger the
databinding
when the search button is clicked?
--
Thanks
Diane


Eliyahu Goldin said:
Diane,

A gridview displays its content. If there is no content, there is nothing
to
display. In most scenarios a gridview gets populated as a result of
databinding. Probably, you are calling DataBind method for the gridview
or
for the page. In the latter case, replace a DataBind call for the page
with
DataBind calls to specific components that need databinding. And call
DataBind for the grid in the event handler for the search button.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

message Hi,

I have a form with textboxes, a search button and a gridview. The
textboxes
are filled with default values so that the gridview should return all
rows
but not before the user has had the chance to change some of the
textboxes
and has clicked the search button.
How can I avoid the gridview displaying all rows before the search
button
was clicked?
Any Ideas? Thanks
Diane
 
E

Eliyahu Goldin

I think, if you use DataSourceID property, the databinding will take place
automatically as your set the property. Instead use DataSource property.
Than you will have to call DataBind manually.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Diane Truyens said:
Thanks Eliyahu for your answer. I'm new in ASP(.net) probably that's why
it
is not yet fully clear to me how to control databinding. I use an
objectdatasource with a tableadapter to populate my gridview. I presume
this
is an 'automated' databind? How can I prevent it and trigger the
databinding
when the search button is clicked?
--
Thanks
Diane


Eliyahu Goldin said:
Diane,

A gridview displays its content. If there is no content, there is nothing
to
display. In most scenarios a gridview gets populated as a result of
databinding. Probably, you are calling DataBind method for the gridview
or
for the page. In the latter case, replace a DataBind call for the page
with
DataBind calls to specific components that need databinding. And call
DataBind for the grid in the event handler for the search button.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Diane Truyens said:
Hi,

I have a form with textboxes, a search button and a gridview. The
textboxes
are filled with default values so that the gridview should return all
rows
but not before the user has had the chance to change some of the
textboxes
and has clicked the search button.
How can I avoid the gridview displaying all rows before the search
button
was clicked?
Any Ideas? Thanks
Diane
 
E

Eliyahu Goldin

You can set it either in code-behind or in .aspx file in the Source view.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Diane Truyens said:
Sorry, but I can't see where to set the Datasource property.
When I click on my gridview I see a DataSourceID property but no
DataSource
property.
--
Diane


Eliyahu Goldin said:
I think, if you use DataSourceID property, the databinding will take
place
automatically as your set the property. Instead use DataSource property.
Than you will have to call DataBind manually.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

Diane Truyens said:
Thanks Eliyahu for your answer. I'm new in ASP(.net) probably that's
why
it
is not yet fully clear to me how to control databinding. I use an
objectdatasource with a tableadapter to populate my gridview. I
presume
this
is an 'automated' databind? How can I prevent it and trigger the
databinding
when the search button is clicked?
--
Thanks
Diane


:

Diane,

A gridview displays its content. If there is no content, there is
nothing
to
display. In most scenarios a gridview gets populated as a result of
databinding. Probably, you are calling DataBind method for the
gridview
or
for the page. In the latter case, replace a DataBind call for the page
with
DataBind calls to specific components that need databinding. And call
DataBind for the grid in the event handler for the search button.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

in
message Hi,

I have a form with textboxes, a search button and a gridview. The
textboxes
are filled with default values so that the gridview should return
all
rows
but not before the user has had the chance to change some of the
textboxes
and has clicked the search button.
How can I avoid the gridview displaying all rows before the search
button
was clicked?
Any Ideas? Thanks
Diane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top