typed dataset xsd

R

Rotsey

Hi,

I have created a typed dataset (xsd file) with 2 tables and a relation
between them
in VS2005.

How I do I now bind that dataset to a Gridview??

When i do this the page is blank.

ds = New DataSet1()

gridview1.Datasource = ds
gridview1.DataBind()


Example code would be helpful cause I am lost??

rotsey
 
S

sloan

You have to pick one of the tables.
gridview1.Datasource = ds.Tables[0];
gridview1.DataBind()

And you probably have to define some fields (boundColumns?) in the Grid
itself.
 
S

Scott M.

Making an instance of a typed dataset is only step one. You need to
populate it with data before a grid that is bound to it would show anything.
 
R

Rad [Visual C# MVP]

Hi,

I have created a typed dataset (xsd file) with 2 tables and a relation
between them
in VS2005.

How I do I now bind that dataset to a Gridview??

When i do this the page is blank.

ds = New DataSet1()

gridview1.Datasource = ds
gridview1.DataBind()

Example code would be helpful cause I am lost??

rotsey

You don't seem to be populating your dataset with any data! Also, if there
is more than one table, you need to set the datamember property to one of
the tables
 
R

Rotsey

Guys,

I realize I have to populate the dataset.

I am trying to create a Grdview with nested data
ie showing parent/child rows.

I have found out doing some googling that all I do is
set up a relation in the dataset between the 2 tables
and then bind it to a grdiview and it will do the rest.

I have this code now.
Dim dtProj As DataSet1.ProjectsDataTable

Dim dtUser As DataSet1.UsersDataTable

dtProj = New DataSet1TableAdapters.ProjectsTableAdapter().GetProjects

dtUser = New DataSet1TableAdapters.UsersTableAdapter().GetUsers

Me.GridView1.DataSource = dtProj

Me.DataBind()

Here I am only binding one table. How do I bind the dataset???????

rotsey
 
S

Scott M.

You are already binding your GridView to a table in the dataset. That's all
you need.
 
R

Rotsey

But I am trying to bind to the dataset.

So how do you get the parent/child functionality in the
gridview??????????????/
 
R

Rotsey

thanks sloan.

but I was lead to believe that I could point a dataset at a gridview

and it would render the grid with + and - where you could
expand and collapse rows.

is this just fantasy land??????

I just had a thought, as I don't want edit capability would
crystal reports do the job??????????????
 
S

Scott M.

You don't point DataSets at controls, you point controls a data sources
(such as DataSets).
 
S

Scott M.

And, if you'd like to continue being sarcastic, you'll have a hard time
getting any information. I was simply trying to alert you to the basic
premis of databinding, which by your question seemed like it needed some
enlightenment.
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top