2+ controls sharing DataSource

  • Thread starter Thread starter Rajko Bogdanovic - DX Squad
  • Start date 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
 
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.
 
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.
 
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.
 
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
 
Back
Top