Lake Worke R

myWork.

need skills. i'm worker.

Name:
Location: 板橋, 台北, Taiwan

free is the end. 單車 單眼 電影 電玩 音樂 美食 旅行 咖啡 回憶 樂觀 悲觀 自閉 自卑 矛盾 作做 虛偽 過敏 失眠 人生 台灣 台北 板橋 文山 苗栗 竹南 頭份 雲林 斗六 君毅 忠信 聯大 雲科 FRIENDS

Monday, March 10, 2014

ASP.NET 動態註冊事件(RadioButtonList SelectedIndexChanged)

Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
' register radiobuttonlist event
For i As Int16 = 1 To 23 Step 1
Dim componentTemp As RadioButtonList = Me.Master.FindControl("ContentPlaceHolder1").FindControl("RadioButtonList" + i.ToString())
AddHandler componentTemp.SelectedIndexChanged, AddressOf RadioButtonList_SelectedIndexChanged
Next

End Sub


要注意的是有掛 Master Page 則在 FindControl 時要先查 ContentPlaceHolder1

還有, 本語法需置於 Page_Init 中, Page_Load 時還無法取得元件.

Labels:

0 Comments:

Post a Comment

<< Home