Reputation: 1
I am trying to bind a list to data repeater in C#. the basic code works:
List<string> arrlist = new List<string>();
arrlist.Add("item 1");
arrlist.Add("item 2");
arrlist.Add("item 3");
arrlist.Add("item 4");
arrlist.Add("item 5");
dataRepeater1.DataSource = arrlist;
dataRepeater1.DataBind();
But when I try to Bind the the list to the data repeater, Visual Studio 2010 is not familiar with the subroutine .DataBind() and that's why the next order can not be debugged. How can I bind the list to the data repeater?
Upvotes: 0
Views: 2240
Reputation: 7748
Note that the doc states:
Setting the DataSource property of the DataRepeater control has no effect. The DataSource properties of the child controls determine what is displayed at run time.
I believe you should be adding controls to the DataRepeater. It is the child controls of the DataRepeater that should bound to your data source.
See:
Upvotes: 1
Reputation:
The dataRepeater control is a winforms control and winforms do not have the DataBind() method like ASP.NET webforms do.
Upvotes: 0
Reputation: 2201
As show HERE, you can use DataBind with VB. Probably you explaination error is not so clear.
Upvotes: 0