雖然我應該八萬年都不會用這兩個控制項,但今天幫人家改了一個莫名其妙的問題,就順便紀錄一下吧
必須寫在Page_Init,且MultiView在新增時不能放在Page_Load裡面,不然有時候會當掉….超怪!! ```vb
Protected Sub Page_Init(ByVal Sender As Object, ByVal e As EventArgs) Handles Me.Init
If Not Page.IsPostBack Then
Me.MultiViewControl.Controls.Clear()
Select Case Request.QueryString("Type")
Case "01"
Me.MenuTab.Items.RemoveAt(0)
Me.MenuTab.Items.RemoveAt(0)
Me.MenuTab.Items.RemoveAt(0)
Me.MenuTab.Items(0).Selected = True
Me.MultiViewControl.Controls.Add(View4)
Case "02"
Me.MenuTab.Items.RemoveAt(0)
Me.MenuTab.Items.RemoveAt(1)
Me.MenuTab.Items.RemoveAt(1)
Me.MenuTab.Items(0).Selected = True
Me.MultiViewControl.Controls.Add(View2)
Case Else
Me.MenuTab.Items.RemoveAt(3)
Me.MultiViewControl.Controls.Add(View1)
Me.MultiViewControl.Controls.Add(View2)
Me.MultiViewControl.Controls.Add(View3)
End Select
End If
End Sub
1 |
|