473,387 Members | 1,535 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,387 software developers and data experts.

2+ controls sharing DataSource


I just realized that if two (or more) controls use the same
datasource, the datasource.Select() will fire for each control. Is
there no way to get around this?

Thanks.

rb
Oct 21 '06 #1
4 1409
Are you talking about declarative databinding with DataSourceID property?

You can use good old DataSource= syntax and run the DataBind() method only
for the control you wish to databind.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Rajko Bogdanovic - DX Squad" <ra****@dxsquad.comwrote in message
news:2u********************************@4ax.com...
>
I just realized that if two (or more) controls use the same
datasource, the datasource.Select() will fire for each control. Is
there no way to get around this?

Thanks.

rb

Oct 22 '06 #2
On Sun, 22 Oct 2006 11:23:15 +0200, "Eliyahu Goldin"
<RE**************************@mMvVpPsS.orgwrote:
>Are you talking about declarative databinding with DataSourceID property?

You can use good old DataSource= syntax and run the DataBind() method only
for the control you wish to databind.
Yea... I realize that. I've been (desperately) trying to stick to
datasources and "forget" about datasets - I'm under impression that MS
promotes this method (am I wrong?) and am trying to stay in the
mainstream and leave as much obsolete code (&style) behind me.

Thanks.
Oct 22 '06 #3
You are making the same mistake as many other developers. Microsoft may
offer a new way of doing the same thing not because the other way is
obsolete. Rather there are scenarios where the new way is simpler or more
efficient or is the only possible option. There are still scenarios where
the old way is more appropriate. For example, Microsoft offers you
server-side methods for emitting javascript to client. In some scenarios,
like user controls, it is good. But in the vast majority of cases placing
javascript inside the aspx page is much better.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Rajko Bogdanovic - DX Squad" <ra****@dxsquad.comwrote in message
news:9u********************************@4ax.com...
On Sun, 22 Oct 2006 11:23:15 +0200, "Eliyahu Goldin"
<RE**************************@mMvVpPsS.orgwrote:
>>Are you talking about declarative databinding with DataSourceID property?

You can use good old DataSource= syntax and run the DataBind() method only
for the control you wish to databind.

Yea... I realize that. I've been (desperately) trying to stick to
datasources and "forget" about datasets - I'm under impression that MS
promotes this method (am I wrong?) and am trying to stay in the
mainstream and leave as much obsolete code (&style) behind me.

Thanks.

Oct 22 '06 #4
On Sun, 22 Oct 2006 16:34:36 +0200, "Eliyahu Goldin"
<RE**************************@mMvVpPsS.orgwrote:
>You are making the same mistake as many other developers. Microsoft may
offer a new way of doing the same thing not because the other way is
obsolete.
I wouldn't wanna start a huge discussion/"war", but MS did a damn good
job "showing the door" to DataSet, DataAdapter. There doesn't seem to
be a way to bind controls to DataSet in design-time - except in
codebehind. In addition, when you realize that simple controls
(textboxes et al) can no longer be hooked up to any form of data
source but have to sit inside FormView or DetailsView, which, in turn,
can *easily* be hooked up to DataSource but not to DataSet (except in
codebehind)... I thought: "I hate it but I better get used to it
'cause that's the way MS promotes".

Aaaaaaaaaaanyway, thanks for your time Eliyahu.

rb
Oct 26 '06 #5

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

Similar topics

1
by: Steven K | last post by:
Hello, I am using the following code which works. My question is does the OleDbDataReader need to be closed and then re-executed for every control? Is there a more effecient way of doing this...
4
by: V. Jenks | last post by:
What seems like a simple thing is apparently not so straightforward? I have a datalist. Inside of that datalist is an <itemtemplate> secion which contains other server controls such as a...
3
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
1
by: Joe | last post by:
While I understand that Server Side Includes still work, I realize it's not the best practice for sharing code such as a common set of includes between screens. In ASP.NET I've already built...
3
by: Mike Collins | last post by:
I have some controls that I am creating dynamically. After the user finishes entering their answers in these controls, I would like to iterate through these controls and get the answers out. I have...
0
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event,...
0
by: Amil Hanish | last post by:
Can I reuse the same DataSource on a page? I have two user controls that need the data from a DataSource; can I reuse a DataSource for both controls? What would be a good way to allow my user...
4
by: Mike P2 | last post by:
Hi. I'm writing controls that have to query the database, and it bothers me that I might have several of these controls on a page that each create, open, and close their own connection with the...
0
by: morathm | last post by:
I have a windows client database management application written in C# that connects to remote web services to do all the heavy work. The thin-client app uses strong typed datasets, all maintained at...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.