2+ controls sharing DataSource

Discussion in 'ASP .Net' started by Rajko Bogdanovic - DX Squad, Oct 21, 2006.

  1. 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
    Rajko Bogdanovic - DX Squad, Oct 21, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    >
    > 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
    Eliyahu Goldin, Oct 22, 2006
    #2
    1. Advertising

  3. On Sun, 22 Oct 2006 11:23:15 +0200, "Eliyahu Goldin"
    <> 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.
    Rajko Bogdanovic - DX Squad, Oct 22, 2006
    #3
  4. 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" <> wrote in message
    news:...
    > On Sun, 22 Oct 2006 11:23:15 +0200, "Eliyahu Goldin"
    > <> 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.
    Eliyahu Goldin, Oct 22, 2006
    #4
  5. On Sun, 22 Oct 2006 16:34:36 +0200, "Eliyahu Goldin"
    <> 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
    Rajko Bogdanovic - DX Squad, Oct 26, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven K

    controls sharing one OleDbDataReader

    Steven K, Apr 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    293
    Manohar Kamath [MVP]
    Apr 9, 2004
  2. Francis

    User controls sharing one dataset

    Francis, May 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    317
    Francis
    May 4, 2004
  3. Vlade

    Sharing User Controls

    Vlade, Jun 1, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    363
    John Saunders
    Jun 2, 2004
  4. Shikari Shambu
    Replies:
    3
    Views:
    2,048
    John Saunders
    Jul 28, 2004
  5. axis
    Replies:
    2
    Views:
    518
    Jonathan Allen
    Sep 25, 2004
Loading...

Share This Page