Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > 2+ controls sharing DataSource

Reply
Thread Tools

2+ controls sharing DataSource

 
 
Rajko Bogdanovic - DX Squad
Guest
Posts: n/a
 
      10-21-2006

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
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      10-22-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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



 
Reply With Quote
 
 
 
 
Rajko Bogdanovic - DX Squad
Guest
Posts: n/a
 
      10-22-2006
On Sun, 22 Oct 2006 11:23:15 +0200, "Eliyahu Goldin"
<(E-Mail Removed)> wrote:

>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.
 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      10-22-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Sun, 22 Oct 2006 11:23:15 +0200, "Eliyahu Goldin"
> <(E-Mail Removed)> wrote:
>
>>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.



 
Reply With Quote
 
Rajko Bogdanovic - DX Squad
Guest
Posts: n/a
 
      10-26-2006
On Sun, 22 Oct 2006 16:34:36 +0200, "Eliyahu Goldin"
<(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set FormView's dropdownlist controls datasource dynamically Rabbit ASP .Net 0 03-20-2006 03:02 AM
Positioning of "non-positioned controls" (datasource etc) =?Utf-8?B?TWFya3VzIFJ5dHRlcmt1bGw=?= ASP .Net 0 03-15-2006 08:04 AM
DataSource Controls =?Utf-8?B?RnJhbmNpcyBSZWVk?= ASP .Net 2 03-03-2006 07:31 PM
Do you use the new datasource controls? Alan Silver ASP .Net 12 12-01-2005 01:54 PM
How to handle exceptions with the new datasource controls =?Utf-8?B?UmljYXJkbw==?= ASP .Net 1 11-09-2005 09:14 AM



Advertisments