- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的 asp.net c# 页面上,我有两个带有 ajax CalendarExtenders 的文本框(开始日期和结束日期)。用户选择开始日期,然后选择结束日期。在选择结束日期时,我如下所示绑定(bind)我的网格;
protected void calEndDate_TextChanged(object sender, EventArgs e)
{
BindGrid();
}
在网格中我有一个带有以下代码的命令按钮
protected void gvAllRoomStatus_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Manage")
{
GridViewRow row = gvAllRoomStatus.Rows[Convert.ToInt16(e.CommandArgument)];
int BookingID = Convert.ToInt32(row.Cells[1].Text);
DataClassesDataContext context = new DataClassesDataContext();
Session["BookingID"] = BookingID;
Response.Redirect("CheckIn.aspx");
}
}
当用户转到该页面并单击后退按钮时,所有选定的日期和 GridView 数据都会消失。知道 View 状态消失的原因吗?
最佳答案
ViewState
属于当前 Page
。
看看:http://www.codeproject.com/Articles/37753/Access-ViewState-Across-Pages
Yes, we can access the viewstate variables across pages. This is only possible if Cross Page Posting or Server.transfer is used to redirect the user to other page. If Response.redirect is used, then ViewState cannot be accessed across pages.
因此您可以使用 Server.Transfer
或使用 Session
。
关于c# - viewstate 在 response.redirect 上消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14430003/
如何使用 HttpContext 访问当前页面的 ViewState 我有一个需要实现的 ViewStateUtil 类: public static T GetViewState(ViewS
我们最近将网站迁移到 .NET 4.5,其中一项更改是将 targetFramework="4.5"添加到 httpRuntime 以选择加入 ASP.NET 4.5 行为。一切都按预期工作,直到我们
来自 Microsoft 的页面 Understanding ASP.NET View State : in the instantiation stage of the page life cycl
我在我的 ASPX 页面上禁用了 ViewState: 我有以下类(class): public class DashboardUpdatePanel : UpdatePanel { pub
我同意 the best way to shorten the ViewState is to disable it在不需要它的 ASP.Net 控件上。从一开始就保持小规模是一个好习惯。 我还听说它
我正在解决我们应用程序的一些安全问题,我们将 ViewStateEncryptionMode 设置为 true(在 web.config 中)。我注意到仍然有一个 _VIEWSTATE 字段,现在在
Asp.Net 有一些选项可以影响页面的 ViewState 生成方式(加密、添加 mac、ViewStateUserKey)。 我想自己做,不是基于配置,而是基于我自己的使用其他算法进行序列化和加密
我对如何在 C# 中使用 ViewState 感到困惑,例如使用的好处是什么: ViewState["VST"]="Value1"; Lable1.Text= ViewState["VST"].ToS
背景: 我有一个页面,其中有各种使用 JavaScript 处理的客户端事件。我想将其中一些事件与服务器端事件“同步”,或者以其他方式从代码隐藏调用函数。 我想用 JavaScript 调用的一些函数
我有一个带有 primefaces 3.5 的 JSF 2.2.0-m12 应用程序。由于我将应用程序从 JBoss 7.1.1 移植到 Tomcat 7.0.39,重新加载页面后输入字段(输入文本、
我正在编写一个程序来解码编辑并在 python 中重新编码 ViewState。我已经成功地找到了 View 状态并解码了 base64 编码的字符串,但在尝试反序列化时遇到了困难。有没有办法使用 p
我可以尝试将一些数据保存到 ViewState,但收到此错误:Microsoft JScript 运行时错误:Sys.WebForms.PageRequestManagerServerErrorExc
我在一个页面上有几个 Div 标签,它们是动态的,即根据某些标准,它们对用户可见或不可见。我想将它们添加到页面的 View 状态,以便在回发时它们不会再次隐藏,我该怎么做? 最佳答案 我只会使用 AS
抓这个! 我已经用谷歌搜索了这个。1. 假设我有一个包含几个文本框的网络表单,ID 为 textbox1、textbox2、textbox3。他们都启用了 View 状态。我在这些文本框中放置了一些值
代码隐藏中有一些 View 状态的东西,然后有一个更新面板。当我将其添加到母版页引用的子页面时,它破坏了我之前从用户控件中获得的所有以前可用的功能。 child 掌握后面的页面代码 protected
假设我有一个对象集合 List collection = new List(); 以及将插入这些对象的字典 Dictionary> sections = new Dictionary>(); // e
我编写了一些网页,这些网页使用需要 ViewState 值的常见例程。 能否将 ViewState 传递到函数中? 如果是,怎么做到的? 如果没有,我还能如何从类中的方法访问它们? 最佳答案 这是关键
问题是,我需要在 CallBack 请求期间保留 ViewState。 我知道当请求是 CallBack 时,ASP.NET 默认情况下不会保存页面状态。所以,我需要一个替代方案来让它工作。 ASP.
我有一个 List 类型的列表.我想将它存储在 ViewState 中。如何做到这一点? private List JobSeekersList { get; set; } 最佳答案 基本上你只需要使
我编写了一个 ASP.NET 应用程序,它在服务器的 IIS7 中运行。如果我在浏览器中打开此网络表单并向我显示站点代码,我会看到... 我有很多控件,如按钮、标签、文本框和 ListView。我尝试
我是一名优秀的程序员,十分优秀!