GridView DataSourceID Business-Tier Class

Discussion in 'ASP .Net Web Controls' started by jeremy.brewster@akqa.com, Jun 27, 2006.

  1. Guest

    Hello

    I am attempting to setup the ASP.NET 2.0 GridView to access a business
    tier class which will provide data to the GridView, via an object data
    source object. My business class returns a strongly typed dataset to
    the GridView/object data source (this business tier class delegating
    the creation of the data to a data tier) where the dataset is called
    CustomDataSet. The business class method is as follows

    public CustomDataSet GetRegistrationLevelsByAgeReport()
    {
    GetRegistrationLevelsByAgeCommand command = new
    GetRegistrationLevelsByAgeCommand(this.CustomDataSet);
    this.CommandExecutor.Execute(command);

    return command.ResultSet;
    }


    My problem is that the strongly typed dataset contains MULTIPLE
    strongly typed data tables, the one that I require being called
    "RegistrationLevelsByAgeReports". I want to be able to set the data
    binding in such a way that I can inform the object data source to grab
    the required data table without breaking the standard pattern for our
    business tier methods, which always return a CustomDataSet object, not
    the individual required data table. I can do this using the DataSource
    property (e.g. this.ReportGridView.DataSource = new
    RegistrationManager().GetRegistrationLevelsByAgeReport().RegistrationLevelsByAgeReports)
    but I'm attempting to wire up the data source via the object data
    source object in order to define paging and caching.

    My business class is called RegistrationManager and the select method
    that returns data from this business class is called
    "GetRegistrationLevelsByAgeReport".

    The code for my object data source is:

    <asp:eek:bjectdatasource id="ObjectDataSource1" runat="server"
    typename="CustomNamespace.RegistrationManager"
    selectmethod="GetRegistrationLevelsByAgeReport"></asp:eek:bjectdatasource>

    Is there any way to tell an object data source/GridView to define its
    data as a child element of a data source (e.g. DataTable object)?

    I've tried using the object data source's Object_Creating event but the
    problem with this seems to be that the typename in my object data
    source is the type of the business object and not the type of the
    strongly typed data table.

    Any advice would be appreciated.

    Thanks

    Jez
    , Jun 27, 2006
    #1
    1. Advertising

  2. Martin Guest

    I've been looking at writing my own custom (multi-viewed) datasource control
    to get round this.

    How have you been getting on, since you posted?

    Martin

    <> wrote in message
    news:...
    > Hello
    >
    > I am attempting to setup the ASP.NET 2.0 GridView to access a business
    > tier class which will provide data to the GridView, via an object data
    > source object. My business class returns a strongly typed dataset to
    > the GridView/object data source (this business tier class delegating
    > the creation of the data to a data tier) where the dataset is called
    > CustomDataSet. The business class method is as follows
    >
    > public CustomDataSet GetRegistrationLevelsByAgeReport()
    > {
    > GetRegistrationLevelsByAgeCommand command = new
    > GetRegistrationLevelsByAgeCommand(this.CustomDataSet);
    > this.CommandExecutor.Execute(command);
    >
    > return command.ResultSet;
    > }
    >
    >
    > My problem is that the strongly typed dataset contains MULTIPLE
    > strongly typed data tables, the one that I require being called
    > "RegistrationLevelsByAgeReports". I want to be able to set the data
    > binding in such a way that I can inform the object data source to grab
    > the required data table without breaking the standard pattern for our
    > business tier methods, which always return a CustomDataSet object, not
    > the individual required data table. I can do this using the DataSource
    > property (e.g. this.ReportGridView.DataSource = new
    > RegistrationManager().GetRegistrationLevelsByAgeReport().RegistrationLevelsByAgeReports)
    > but I'm attempting to wire up the data source via the object data
    > source object in order to define paging and caching.
    >
    > My business class is called RegistrationManager and the select method
    > that returns data from this business class is called
    > "GetRegistrationLevelsByAgeReport".
    >
    > The code for my object data source is:
    >
    > <asp:eek:bjectdatasource id="ObjectDataSource1" runat="server"
    > typename="CustomNamespace.RegistrationManager"
    > selectmethod="GetRegistrationLevelsByAgeReport"></asp:eek:bjectdatasource>
    >
    > Is there any way to tell an object data source/GridView to define its
    > data as a child element of a data source (e.g. DataTable object)?
    >
    > I've tried using the object data source's Object_Creating event but the
    > problem with this seems to be that the typename in my object data
    > source is the type of the business object and not the type of the
    > strongly typed data table.
    >
    > Any advice would be appreciated.
    >
    > Thanks
    >
    > Jez
    >
    Martin, Jul 30, 2006
    #2
    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. rob

    ASP v2 & 3-tier or 2-tier

    rob, Aug 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    406
    Steve C. Orr [MVP, MCSD]
    Aug 13, 2004
  2. NOSPAM

    2 tier to 3 tier?

    NOSPAM, Oct 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    426
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 14, 2004
  3. dgk
    Replies:
    0
    Views:
    617
  4. Nemisis
    Replies:
    1
    Views:
    489
    sloan
    Aug 22, 2006
  5. hfritz

    Gridview and DatasourceID

    hfritz, Aug 28, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    5,083
Loading...

Share This Page