我試圖找出如何在itemCommand
塊中設置ID變量,然後在PagePropertiesChanged
塊中共享它。試圖找出如何共享變量之間.net代碼之間潛在
我在想這是否可行?
這裏是什麼,我試圖做一個簡單的例子,
Public Shared ID As Integer
Private Sub DataListCategories_ItemCommand(source As Object, e As DataListCommandEventArgs) Handles DataListCategories.ItemCommand
If (e.CommandName.Equals("ClickCategory")) Then
ID = e.CommandArgument
End if
End sub
Private Sub ListViewGallery_PagePropertiesChanged(sender As Object, e As EventArgs) Handles ListViewGallery.PagePropertiesChanged
Me.ListViewGallery.DataSource = Dal.GetPhotographyByCategory(ID)
Me.ListViewGallery.DataBind()
End Sub
你是什麼意思「共享變量之間的潛艇」? – Gabor
您是否想要在回傳之間保持價值? –