GridView DataSourceID Business-Tier Class

J

jeremy.brewster

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
 
M

Martin

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top