Hello.
I've populated a typed dataset and now I only want to bind one of the tables
inside to datagrid - how is this accomplished?

My code:
private void FillDataGridTDS()
{
BLTask blTask = new BLTask();
DSTaskSchedules dsTaskSchedules;
blTask.GetAllTasks(out dsTaskSchedules);
// dsTaskSchedules is holding all my tables with relation etc. And now i
only want to use one of these tables as a datasource.
dgTasks.DataSource = dsTaskSchedules;
dgTasks.DataBind();


}

This is a snippet from my presentationlayer. And I dont want to set the
datamember of the datagrid in this layer. So it's to be done in the BLL :O)

The BLL:
public void GetAllTasks(out DSTaskSchedules dsTaskSchedules)
{
dsTaskSchedules = null;

DATask daTask = new DATask();
daTask.PopulateTDSTaskSchedules(out dsTaskSchedules);
dsTaskSchedules.DataSetName
// dsTaskSchedules is holding all my tables with relation etc. And now i
only want to use one of these tables as a datasource.
}

Kind regards

Re: Selecting table in typed dataset by Miha

Miha
Wed Aug 18 05:20:34 CDT 2004

Hi Janus,

"Janus" <Janus@discussions.microsoft.com> wrote in message
news:BF2AE25C-1E4C-466D-80ED-6C4ED6CE31D3@microsoft.com...
> Hello.
> I've populated a typed dataset and now I only want to bind one of the
> tables
> inside to datagrid - how is this accomplished?
>
> My code:
> private void FillDataGridTDS()
> {
> BLTask blTask = new BLTask();
> DSTaskSchedules dsTaskSchedules;
> blTask.GetAllTasks(out dsTaskSchedules);
> // dsTaskSchedules is holding all my tables with relation etc. And now i
> only want to use one of these tables as a datasource.
> dgTasks.DataSource = dsTaskSchedules;

Instead of the line above, try:
dgTasks.DataSource = dsTaskSchedules.YourTable;

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

> dgTasks.DataBind();
>
>
> }
>
> This is a snippet from my presentationlayer. And I dont want to set the
> datamember of the datagrid in this layer. So it's to be done in the BLL
> :O)
>
> The BLL:
> public void GetAllTasks(out DSTaskSchedules dsTaskSchedules)
> {
> dsTaskSchedules = null;
>
> DATask daTask = new DATask();
> daTask.PopulateTDSTaskSchedules(out dsTaskSchedules);
> dsTaskSchedules.DataSetName
> // dsTaskSchedules is holding all my tables with relation etc. And now i
> only want to use one of these tables as a datasource.
> }
>
> Kind regards
>