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 / Building Controls / September 2004

Tip: Looking for answers? Try searching our database.

Datasets & Controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carter - 23 Sep 2004 18:42 GMT
I have 5 controls on a page, each having it's own connection to a database
and different queries per control.  Each control is displayed by the user
clicking on a menu.  Simple enough.

However, because they are all on one page, each connection and dataset is
created when the first page is loaded, causing that initial opening of the
web site to take a long time.  How best to avoid this, and to load the
dataset only when and if the user clicks on a menu, which is in another
control.
John Saunders - 23 Sep 2004 19:25 GMT
>I have 5 controls on a page, each having it's own connection to a database

Are all 5 controls connecting to the same database?

Also, are the connections created inside of the controls? If so, perhaps you
should let the connection be on the page, and pass the connection to the
controls through a property??

Do they operate by creating a DataSet? If so, perhaps it would be better if
the page owned the dataset(s) and passed them to the controls through a
property?

> and different queries per control.  Each control is displayed by the user
> clicking on a menu.  Simple enough.

You say "displayed by the user clicking on a menu". Are they invisible
before a menu item is clicked? Do you change their visibility with the
Visible property of the controls? If so, one way to control the DataSet
loading is to not load the DataSet if the control is not Visible.

John Saunders
Carter - 23 Sep 2004 23:43 GMT
The 5 controls use 2 different databases.

The connections are created inside the controls, mainly because the controls
will possibly be used in other programs, so the connection has to remain
with the control; maybe I should be using custom controls but at this time
I'm not sure I need to.

They all use a dataset except one that uses a datareader.

Making the controls invisible is a good idea, I hadn't thought of that.
Currently the controls are visible according to the panel they are in, when
the user clicks on an item, the corresponding panel becomes visible, but I
agree making the controls invisible first would be more practical, then I
can create the connection and dataset when the control becomes visible.

Another question?  How do I pass data from the main page to the control?
The main page has a ClientID; for instance, the user clicks on "address" to
get the address for that particular client.  The address control needs to
query the database and create the dataset according to the clientid, fill in
the fields on the control, then display it on the page.  I tried to create a
class with public properties but would lose the client id when the page
reloads.

Thanks for your help; as you can tell, I'm pretty much a beginner.

> >I have 5 controls on a page, each having it's own connection to a database
>
[quoted text clipped - 17 lines]
>
> John Saunders

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.