|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GridView DataSourceID Business-Tier ClassI 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:objectdatasource id="ObjectDataSource1" runat="server" typename="CustomNamespace.RegistrationManager" selectmethod="GetRegistrationLevelsByAgeReport"></asp:objectdatasource> 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 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 <jeremy.brews***@akqa.com> wrote in message Show quoteHide quote news:1151409771.704326.237720@i40g2000cwc.googlegroups.com... > 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:objectdatasource id="ObjectDataSource1" runat="server" > typename="CustomNamespace.RegistrationManager" > selectmethod="GetRegistrationLevelsByAgeReport"></asp:objectdatasource> > > 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 >
changing cursor of ImageButton
TextBox TextChanged Event Adding WebControl using a Button.... Custom Controls with non-String Attributes Reference of Available Metadata Attributes Dynamically Creating A CSS Class Validation messages not displaying Response.Redirect not being called after sending an email How to use gridview Bitmap as a Image web control |
|||||||||||||||||||||||