我有一箇中繼器更改一個asp:中繼
<asp:Label id="lblsub" runat=server text="sdds" />
我試圖改變這個標籤的文本內這個標籤內標籤的文字,這是背後
For Each Item As RepeaterItem In dg.Items
Dim l As New label
l = CType(Item.FindControl("lblsub"), System.Web.UI.WebControls.Label)
l.text="test"
Next
不幸的是,代碼此代碼不適用於我,文本值不會改變,所以我會很樂意在這裏提供一些幫助
謝謝
不知道我的朋友在你的答案是什麼,我沒有看到如何更改標籤 – baaroz
我得到空你的代碼太文:System.NullReferenceException:對象未將引用設置爲對象的實例。 – baaroz
你在什麼時候嘗試改變文本?你可以將代碼移動到ItemDataBound事件嗎?這種方法絕對有效,所以一定還有其他的事情要做。 –