SqlDataSource control activating on button click

  • Thread starter Thread starter Hrvoje Vrbanc
  • Start date Start date
H

Hrvoje Vrbanc

Hello all!

As I have only recently started to use native ASP.NET 2.0 data access
controls (and found them to be very powerful), I have one question that I
was unable to find the answer to:

- I have an ASPX page with a SqlDataSource control with Select, Update and
Delete calls to stored procedures and a GridView bound to SqlDataSource,

- everything works fine, the date gets displayed when the page is loaded and
Delete ad Update also work OK.

Now, I want the page not to display any data until a button is clicked, or
better said until a button is clicked and a value from a TextBox is passed
as a Select statement parameter to the SqlDataSource.

How to prevent the GridView from filling onLoad and how to refresh it on
Button click?

Thank you in advance,
Hrvoje
 
You can bind the datasource of the gridview on button click.
I mean, in the button click routine, Add code similar to
Gridview1.DataSource = SqlDataSource1;
GridView1.DataBind();
And remove the DataSource part from the GridView definition/declaration in
the aspx page.

Hope this helps.

--------------------
From: "Hrvoje Vrbanc" <[email protected]>
Subject: SqlDataSource control activating on button click
Date: Tue, 4 Dec 2007 16:44:01 +0100
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: dalmatinac.recro.hr 195.137.173.99
Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:52358
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hello all!

As I have only recently started to use native ASP.NET 2.0 data access
controls (and found them to be very powerful), I have one question that I
was unable to find the answer to:

- I have an ASPX page with a SqlDataSource control with Select, Update and
Delete calls to stored procedures and a GridView bound to SqlDataSource,

- everything works fine, the date gets displayed when the page is loaded and
Delete ad Update also work OK.

Now, I want the page not to display any data until a button is clicked, or
better said until a button is clicked and a value from a TextBox is passed
as a Select statement parameter to the SqlDataSource.

How to prevent the GridView from filling onLoad and how to refresh it on
Button click?

Thank you in advance,
Hrvoje

--

Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no rights.
 
Thank you very much, Nanda!
Hrvoje



Nanda Lella said:
You can bind the datasource of the gridview on button click.
I mean, in the button click routine, Add code similar to
Gridview1.DataSource = SqlDataSource1;
GridView1.DataBind();
And remove the DataSource part from the GridView definition/declaration in
the aspx page.

Hope this helps.

--------------------

--

Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no
rights.
 
Back
Top