VB.NET Repeater Simple Data Binding Without Datasource

有些话、适合烂在心里 提交于 2019-11-29 11:23:40

Here's a way to repeat the items. In your page load event, add the following:

Dim repeatTimes() As Integer = New Integer(){1, 2, 3}
myRepeater.DataSource = repeatTimes
myRepeater.DataBind()

The repeater items will be repeated by the number of elements in the Array. In this case, there are 3 elements. The actual contents of the array don't matter, just the number of elements.

EDIT: I don't know VB.NET that well, but I think this should work

Sub Page_Load()
  Dim NumberToRepeat As Integer ''*Should come from the parameter
  If Not Page.IsPostBack Then
    Dim repeatTimes(NumberToRepeat) As Integer
    myRepeater.DataSource = repeatTimes
    myRepeater.DataBind()
  End If
End Sub
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!