Re-use asp:ObjectDataSource

Discussion in 'ASP General' started by SAL, Jul 10, 2008.

  1. SAL

    SAL Guest

    Does anyone know how to re-use the asp:ObjectDataSource control?

    What I want to do is add ONE asp:ObjectDataSource control to my Web form,
    then BIND it to MULTIPLE DropDownList boxes in the Code Behind, since the
    DropDownList boxes will all reference the same Stored Procedure. However,
    you can not do that since that ObjectDataSource is already bound to another
    control on the form. The only way I know to do this is to add multiple
    asp:ObjectDataSource controls to the form with their own unique ID, which
    seems redundant if all the ObjectDataSources will use the same store
    procedure with the same parameters.

    In the Code Behind, how can I create a NEW instance of the
    asp:ObjectDataSource control for each of the DropDownList boxes I want to
    BIND to?
     
    SAL, Jul 10, 2008
    #1
    1. Advertising

  2. SAL wrote:
    > Does anyone know how to re-use the asp:ObjectDataSource control?


    There was no way for you to know it (except maybe by browsing through some
    of the previous questions in this newsgroup before posting yours - always a
    recommended practice) , but this is a classic (COM-based) asp newsgroup.
    ASP.Net bears very little resemblance to classic ASP so, while you may be
    lucky enough to find a dotnet-knowledgeable person here who can answer your
    question, you can eliminate the luck factor by posting your question to a
    group where those dotnet-knowledgeable people hang out. I suggest
    microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Jul 10, 2008
    #2
    1. Advertising

  3. SAL

    SAL Guest

    Thanks. Haven't been here in awhile and Microsoft changed things, so I
    thought I posted it in the right spot. Sorry for the trouble.

    "Bob Barrows [MVP]" wrote:

    > SAL wrote:
    > > Does anyone know how to re-use the asp:ObjectDataSource control?

    >
    > There was no way for you to know it (except maybe by browsing through some
    > of the previous questions in this newsgroup before posting yours - always a
    > recommended practice) , but this is a classic (COM-based) asp newsgroup.
    > ASP.Net bears very little resemblance to classic ASP so, while you may be
    > lucky enough to find a dotnet-knowledgeable person here who can answer your
    > question, you can eliminate the luck factor by posting your question to a
    > group where those dotnet-knowledgeable people hang out. I suggest
    > microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.
    >
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >
    >
     
    SAL, Jul 10, 2008
    #3
    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. =?Utf-8?B?S2VzdGFz?=
    Replies:
    0
    Views:
    361
    =?Utf-8?B?S2VzdGFz?=
    Jul 7, 2005
  2. SAL
    Replies:
    0
    Views:
    451
  3. yanni
    Replies:
    1
    Views:
    768
    Alexey Smirnov
    Nov 9, 2008
  4. MobiBob
    Replies:
    0
    Views:
    516
    MobiBob
    Aug 10, 2010
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    248
    Steven Cheng[MSFT]
    Mar 23, 2006
Loading...

Share This Page