ObjectDataSource and SqlDataSource parameters

Discussion in 'ASP .Net' started by tshad, Feb 4, 2010.

  1. tshad

    tshad Guest

    I have a GridView that has both SqlDataSources and ObjectDataSources. I use
    to only have 3 SqlDataSources and I usually set my parameters in a method
    where I pass the SqlDataSource as a parameter and set the parameters based
    on which parameter is passed.

    ***************************************
    protected void SetData(SqlDataSource sds)
    {
    string exceptionTypes = "";
    string jobs = "";
    JobBucketList jobsList = new JobBucketList();

    // Set up the parameters

    sds.SelectParameters.Clear();

    if (sds == SqlDataSource3)
    ...
    }
    ***************************************

    This worked fine until I added ObjectDataSource. I now need to pass either
    an ObjectDataSource or SqlDataSource but they are different
    They both are DataSourceControls, but DataSourceControl doesn't have a
    SelectParameters parameter like the others do.

    How can I use the method for both?

    Thanks,

    Tom
    tshad, Feb 4, 2010
    #1
    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. osh
    Replies:
    0
    Views:
    1,411
  2. =?Utf-8?B?RGFuaWVsIFIuIEgu?=

    Problems with Parameters and SQLDataSource

    =?Utf-8?B?RGFuaWVsIFIuIEgu?=, Jul 19, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    9,605
    roadhawk
    Dec 31, 2009
  3. Raja
    Replies:
    2
    Views:
    473
    Ed Hinton
    Mar 14, 2008
  4. Keith Patrick

    ObjectDataSource feeding off a SqlDataSource

    Keith Patrick, Dec 16, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    129
    Keith Patrick
    Dec 16, 2005
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

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

Share This Page