I have discovered that a datarepeater object running in virtualmode set to true (ie not bound to any data source) doesnt keep all the items that are added to it programmatically.
A demonstration - create a windows application project using vb - on the form create a datarepeater and set virtual mode to true, set the size to 300 wide by 100 high (see significance later).
Add a text box to it in the dataitem and set the item template AutoSize mode to growandshrink and drag the textbox to the top of the itemtemplate and resize the itemtemplate to fit the textbox. Add a button on the form (not the repeater) and put the code below on the click event.
Dim intwork As Integer
intwork = DataRepeater1.Controls.Count
DataRepeater1.AddNew()
DataRepeater1.CurrentItem.Controls("textbox1").Text = Str(intwork + 1)
Run the program - repeatedly click on the button - items 1,2,3,4,5,6,7 are created then 7 again!!! scrolling to the top of the list shows that 1,2,3 have disappeared and scrolling back 6 and 7 have been deleted but the second 7 hasnt.
Anybody see where i have gone wrong here? Or is it just the way it is because the repeater object hasnt anywhere to keep the data? Anyone discovered any work around, binding to some kind of data object maybe (other than a programming fix (ie keeping the data in an array and refreshing it)?
A similar example bound to a database table works just fine. Thanks in anticipation that some clever people respond.
A demonstration - create a windows application project using vb - on the form create a datarepeater and set virtual mode to true, set the size to 300 wide by 100 high (see significance later).
Add a text box to it in the dataitem and set the item template AutoSize mode to growandshrink and drag the textbox to the top of the itemtemplate and resize the itemtemplate to fit the textbox. Add a button on the form (not the repeater) and put the code below on the click event.
Dim intwork As Integer
intwork = DataRepeater1.Controls.Count
DataRepeater1.AddNew()
DataRepeater1.CurrentItem.Controls("textbox1").Text = Str(intwork + 1)
Run the program - repeatedly click on the button - items 1,2,3,4,5,6,7 are created then 7 again!!! scrolling to the top of the list shows that 1,2,3 have disappeared and scrolling back 6 and 7 have been deleted but the second 7 hasnt.
Anybody see where i have gone wrong here? Or is it just the way it is because the repeater object hasnt anywhere to keep the data? Anyone discovered any work around, binding to some kind of data object maybe (other than a programming fix (ie keeping the data in an array and refreshing it)?
A similar example bound to a database table works just fine. Thanks in anticipation that some clever people respond.