Results 1 to 6 of 6

Thread: Databinding

  1. #1

    Thread Starter
    Member
    Join Date
    May 2001
    Posts
    55

    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?

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    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.

  3. #3
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    what is oData

    Code:
    public DataSet oData = new DataSet();
    Magiaus

    If I helped give me some points.

  4. #4
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    did that code help any?
    Magiaus

    If I helped give me some points.

  5. #5

    Thread Starter
    Member
    Join Date
    May 2001
    Posts
    55
    listView only has a DataBindings member, there is no Datasource member like with most controls

  6. #6
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    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
  •  



Click Here to Expand Forum to Full Width