作者bbgbbg (小葉)
看板Visual_Basic
標題[ASP ] 如何得到另一個form上的物件狀態
時間Wed May 16 22:05:47 2007
小弟希望按下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
推 kylechen:原po是正妹 05/16 23:35
推 fumizuki:請在 WebForm1 使用 Input(Hidden) 儲存WebForm1的狀態 05/17 12:47
推 fumizuki:WebForm1 中執行 Server.Transfer("WebForm2.aspx") 05/17 12:49
→ fumizuki:會將狀態傳給WebForm2,Request("input的id")讀取狀態 05/17 12:49
→ fumizuki:1F是走錯版嗎@@ 05/17 12:50