473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

SqlDataSource control activating on button click

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
Dec 4 '07 #1
2 4780
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" <hr*****@recro.hr>
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: <Om**************@TK2MSFTNGP05.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: dalmatinac.recro.hr 195.137.173.99
Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP05.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.

Dec 4 '07 #2
Thank you very much, Nanda!
Hrvoje

"Nanda Lella[MSFT]" <Na****@online.microsoft.comwrote in message
news:uu**************@TK2MSFTNGHUB02.phx.gbl...
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" <hr*****@recro.hr>
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: <Om**************@TK2MSFTNGP05.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: dalmatinac.recro.hr 195.137.173.99
Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP05.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.

Dec 7 '07 #3

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

Similar topics

0
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls...
3
by: Mike T | last post by:
I'm having a problem with the new ASP.NET 2.0 SqlDataSource object. (my first time using it) I placed a SqlDataSouce object on the page and set its connection properties in the Web.Config. ...
8
by: cider123 | last post by:
In Design mode I open up the SqlDataSource (Configure Data Source) I go all the way through until the last page where you "Test Query" and it takes about 2 seconds to return a response. My...
0
by: kurt.craver | last post by:
I have a component control that I created as a UserControl which contains a SqlDataSource control, a GridView control, a DropDownList control, a TextBox control, and a Button control. The idea is...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
5
by: Luqman | last post by:
I added new rows to the GridView with the following code. I am using SqlDataSource and Sql Server 2000 Northwind Database Customers table. Dim sqlarg As New DataSourceSelectArguments Dim dv...
4
by: mohaaron | last post by:
This seems like it should be simple to do but for some reason I have been unable to make it work. I would like to databind a SqlDataSource to a GridView during the click event of a button. This...
0
by: Sobin Thomas | last post by:
Hi All, How can I bind the Gridview control to Sql Datasource control on a button click(I see majority of the articles binding datasource at page load) I need to enable the paging and sorting of...
1
by: Sobin Thomas | last post by:
Hi All, How can I bind the Gridview control to Sql Datasource control on a button click(I see majority of the articles binding datasource at page load) I need to enable the paging and sorting of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.