Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有用于输入日期的文本框的母版页。3 个内容页面使用此母版页,并根据输入的日期显示不同的数据。现在,当用户从一个内容页面切换到另一个内容页面时,我想在文本框中保留日期。是否可以在不使用 cookie、会话状态和查询字符串的情况下做到这一点?
我相当确定您可以使用 masterViewState来存储值,因为它独立于 ContentPage 的 ViewState。
ViewState
因此,您可以设置TextBox.TextinPage_load并写入ViewStatein MasterPage.PreRender。
TextBox.Text
Page_load
MasterPage.PreRender