Re: 求助PlaceHoder的用法?

看板C_Sharp (C#)作者 (tomex_ou)時間20年前 (2004/11/03 09:55), 編輯推噓4(403)
留言7則, 2人參與, 最新討論串6/11 (看更多)
※ 引述《koji.bbs@bbs.yzu.edu.tw (怎麼來,怎麼走..是吧?)》之銘言: : u wanna this? : private void Page_Load(Object sender, EventArgs e) : { : System.Web.UI.WebControls.Button button1 = new Button(); : button1.Text = "koji"; : PlaceHolder1.Controls.Add(button1); : button1.Click += new EventHandler(button1_Click); : } : void button1_Click(object sender, EventArgs e) : { : Label1.Text = "Good Clicked!!"; : } 動態control的重點在於它的事件及傳入的參數 不可能事先定義好對應的envent函式,除非大家都共用同一個, 假如成立,這參數 (object sender, EventArgs e)將會很有趣! 謝謝,我有想到一點idea了, 等我試出再分享給大家... -- 貫徹分享精神 我為人人,人人為我 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.119.183.211

140.138.238.12 11/03, , 1F
看不懂@@"..小弟學藝不精....
140.138.238.12 11/03, 1F

140.138.238.12 11/03, , 2F
好像懂了...研究看看哈哈
140.138.238.12 11/03, 2F

140.115.205.46 11/03, , 3F
我還是不清楚想要的是啥耶? 可否解釋一下?
140.115.205.46 11/03, 3F

140.138.150.48 11/04, , 4F
我的範例是在pageload就設定好
140.138.150.48 11/04, 4F

140.138.150.48 11/04, , 5F
加上去,所以假設要用成動態,譬如按按鈕a
140.138.150.48 11/04, 5F

140.138.150.48 11/04, , 6F
才出現按鈕B,那麼就會因為ASP LIFECYCLE
140.138.150.48 11/04, 6F

140.138.150.48 11/04, , 7F
的關係,按下按鈕事件也不會觸發!!
140.138.150.48 11/04, 7F
文章代碼(AID): #11Y3gCj1 (C_Sharp)
文章代碼(AID): #11Y3gCj1 (C_Sharp)