2+ controls sharing DataSource

  • Thread starter Rajko Bogdanovic - DX Squad
  • Start date
R

Rajko Bogdanovic - DX Squad

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
 
E

Eliyahu Goldin

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.
 
R

Rajko Bogdanovic - DX Squad

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.
 
E

Eliyahu Goldin

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.
 
R

Rajko Bogdanovic - DX Squad

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top