ASP.NET,用户控件和ViewState丢失了正确的数据,导致尝试进入用户控件事件

问题描述

下午好,我有一个ASP.NET网页,并且创建了一个用户控件,该控件具有一些需要始终可检索的属性。 添加了ViewState来保留信息,但是现在的缺点是,当在同一asp.net页上以及从该控件的函数中添加相同的控件时,我想检索该属性的值,这将检索输入的最后一个值在ViewState中。

非常感谢。

<PersistenceMode(PersistenceMode.InnerProperty),TemplateInstance(TemplateInstance.Single)>
Public Property GuardadoTemporal() As Boolean
    Get
        If ViewState("GuardadoTemporal") Is Nothing Then
            Return false
        Else
            Return CBool(ViewState("GuardadoTemporal"))
        End If
    End Get
    Set(ByVal value As Boolean)
        ViewState("GuardadoTemporal") = value
    End Set
End Property

example for use

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)