|
-
Feb 5th, 2004, 11:08 PM
#1
Thread Starter
Member
Databinding
I have a filled datatable and I'm trying to bind it to a ListView control, I'm currently using that following code:
Code:
listView1.DataBindings.Add(new Binding("text", myDataTable, "ItemName"));
it compiles but doesn't seem to work, I know that the datatable is full. what am I doing wrong?
-
Feb 6th, 2004, 11:33 AM
#2
Frenzied Member
DataSource? DataValue? DataMember? DataBind?
and I always use a dataset to contain my datatables. but I have only worked with ASP.Net Data so far.....
Code:
OleDbConnection oCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\temp\\iis_outside_empty\\db\\NWIND.MDB;Persist Security Info=False");
OleDbDataAdapter oAdapter01 = new OleDbDataAdapter("SELECT CategoryID, CategoryName FROM Categories ORDER BY CategoryName;", oCon);
OleDbDataAdapter oAdapter02 = new OleDbDataAdapter("SELECT SupplierID,CompanyName FROM Suppliers ORDER BY CompanyName;", oCon);
oAdapter01.Fill(oData,"Products");
oAdapter02.Fill(oData,"Suppliers");
rptProducts.DataSource = oData.Tables["Products"].DefaultView;
rptSuppliers.DataSource = oData.Tables["Suppliers"].DefaultView;
Page.DataBind();
that is for a data repeater but the concept is the same
Magiaus
If I helped give me some points.
-
Feb 6th, 2004, 11:35 AM
#3
Frenzied Member
what is oData
Code:
public DataSet oData = new DataSet();
Magiaus
If I helped give me some points.
-
Feb 7th, 2004, 02:42 PM
#4
Frenzied Member
Magiaus
If I helped give me some points.
-
Feb 7th, 2004, 05:04 PM
#5
Thread Starter
Member
listView only has a DataBindings member, there is no Datasource member like with most controls
-
Feb 7th, 2004, 10:49 PM
#6
Frenzied Member
ahh
I don't know I am looking at the listview in the object browser but I don't see any databinding ifo you may have to just read the data in to the ListViewItemCollection yourself.
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|