0
我想更新我的網頁上的多個標籤的文本屬性,我知道下面的命名約定存在。但是,當我嘗試以這種方式訪問它們時,我總是得到一個「輸入字符串格式不正確」的錯誤。如何動態訪問Visual Basic asp網頁中的頁面控件?
For i = 1 To 5
Dim title As Label = CType(Me.Controls("title" & i), Label)
title.Text = alist(i * section).inDate
Dim postDate As Label = CType(Me.Controls("postDate" & i), Label)
postDate.Text = alist(i * section).inDate
Dim depart As Label = CType(Me.Controls("depart" & i), Label)
depart.Text = alist(i * section).department
Dim mess As Label = CType(Me.Controls("mess" & i), Label)
mess.Text = alist(i * section).message
Next