Depending on where your data comes from, you can do different things.
For example, if you have a data source like a DataTable or, an Array, or a collection or whatever, you can do this:
GridView1.DataSource = myDataTable
GridView1.DataBind()
Replace myDataTable with your object.
Alternatively, if you want to use the data from a *DataSource control, you can do this:
GridView1.DataSourceID = mySqlDataSource.ID
GridView1.DataBind()
or
GridView1.DataSourceID = "myDataSource"
GridView1.DataBind()
This sets the DataSourceID property of the GridView to the ID of the data source instead of assigning its DataSource property.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|