[ASP ] 如何得到另一個form上的物件狀態

看板Visual_Basic作者 (小葉)時間18年前 (2007/05/16 22:05), 編輯推噓3(302)
留言5則, 2人參與, 最新討論串1/1
小弟希望按下WebForm2的按鈕後 判斷WebForm1的RadioButton狀態 程式如下 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As system.EventArgs) Handles Button1.Click Dim w1 As WebForm1 = New WebForm1 If w1.RadioButton1.Checked = True Then Label1.Text = "web3" ElseIf w1.RadioButton2.Checked = True Then Label1.Text = "web4" ElseIf w1.RadioButton3.Checked = True Then Label1.Text = "web5" End If End Sub 在WebForm1裡已用public宣告Radiobutton1物件 但執行後 會出現 "並未將物件參考設定為物件的執行個體 " 的訊息 請問各位大大,這個問題要如何解決呢? ps:另外請教,要怎麼在按鈕事件寫入網頁連結? 因為不像hyperlink物件有NavigateUrl和Target可以使用 在此先謝過 各位大大了! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.224.102.36

05/16 23:35, , 1F
原po是正妹
05/16 23:35, 1F

05/17 12:47, , 2F
請在 WebForm1 使用 Input(Hidden) 儲存WebForm1的狀態
05/17 12:47, 2F

05/17 12:49, , 3F
WebForm1 中執行 Server.Transfer("WebForm2.aspx")
05/17 12:49, 3F

05/17 12:49, , 4F
會將狀態傳給WebForm2,Request("input的id")讀取狀態
05/17 12:49, 4F

05/17 12:50, , 5F
1F是走錯版嗎@@
05/17 12:50, 5F
文章代碼(AID): #16Im-y2p (Visual_Basic)