what variable i can use instead of shared?
I have the following variable which creates problem when i use multiples instance of the same web form. Could you please let me know how i could what variables other than shared i can use to achieve this purpose?
P开发者_JS百科ublic strRoleType As String = String.Empty
Protected Shared isAreaSelected As Integer = 0
Protected Shared isStoreSelected As Integer = 0
Protected Shared isHeadOfficeSelected As Integer = 0
Protected Shared isRegionSelected As Integer = 0
Just remove Shared and everything should be fine.
This is a lot of work but it creates form level storage
For each of your shared variables convert it to a property on the WebForm. Then store the values in the ViewState
'default to 0 if blank, else convert to int
Public Property IsAreaSelected() As Integer
    Get
        Return If(ViewState("IsAreaSelected") Is Nothing, 0, Cint(ViewState("IsAreaSelected")))
    End Get
    Set(ByVal value As Integer)
        ViewState("IsAreaSelected") = value
    End Set
End Property
This way the values stay with the page.
Please note I coded this up on the fly and not in VS so you may have to tweak it.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论