Hello Dick,
As Eliyahu has suggested, one way is to directly assign the DataSet object
to DataBound control(such a gridview)'s Datasource property and set the
proper "DataMember". This is just like the programmatic databinding in
ASP.NET 1.X.
If you want to utilize the ObjectDataSource declarative databinding, you
can consider creating a wrapper class which expose a Select method that
will return the certain DataTable(from internal DataSet object) according
to a given input parameter(select parameter in DataSource control). e.g.
==============================
public class WrapperClass
{
private MyDataSet _dataset;
public WrapperClass()
{
_dataset = new MyDataSet();
//fill in datatables here
}
public DataTable Select(string tablename)
{
return _dataset.Tables[tablename];
}
}
===============================
In the ObjectDataSource, you can supply this parameter through the
DataSource control's "Select" parameter collection(from any available
parameter sources or directly embeded in it)
===============
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="Select"
TypeName="WrapperClass">
<SelectParameters>
<asp:ControlParameter ControlID="Label1" Name="tablename"
PropertyName="Text" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
==========================
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.