Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

SqlDataSource control activating on button click

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hrvoje Vrbanc - 04 Dec 2007 15:44 GMT
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
Nanda Lella[MSFT] - 04 Dec 2007 19:06 GMT
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" <hrvojev@recro.hr>
>Subject: SqlDataSource control activating on button click
[quoted text clipped - 33 lines]
>Thank you in advance,
>Hrvoje

Signature

Thank You,
Nanda Lella,

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

Hrvoje Vrbanc - 07 Dec 2007 09:08 GMT
Thank you very much, Nanda!
Hrvoje

> You can bind the datasource of the gridview on button click.
> I mean, in the button click routine, Add code similar to
[quoted text clipped - 46 lines]
>>Thank you in advance,
>>Hrvoje

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.