得到一个GridView和DropDownList的导航离开和返回按钮的ScriptManager后,记住他们的状态他们的、按钮、状态、GridView

由网友(撕心的想念°)分享简介:我有一个页面填一个GridView这是所有工作的罚款。 i have a page filling a gridview which is all working fine. 网格基本上是检索的结果..的过滤器,它们是数下拉菜单和一对文本框的从电网和下拉菜单中的数据保存在会议和整个页面的生命一个UpdatePan...

我有一个页面填一个GridView这是所有工作的罚款。

i have a page filling a gridview which is all working fine.

网格基本上是检索的结果..的过滤器,它们是数下拉菜单和一对文本框的 从电网和下拉菜单中的数据保存在会议和整个页面的生命一个UpdatePanel里面

the grid is basically the result of a search .. the filters for which are a number of dropdowns and a couple of textboxes the data from the grid and dropdowns are saved in the session and the whole page lives inside an updatepanel

当我从页面导航离开(因为它发生通过点击网格内的链接),然后后退按钮它,所有的滴管都回到自己未选中值,网格是无处可看..

when i navigate away from the page (as it happens by clicking a link inside the grid) and then back button to it, all the droppers are back to their unselected values and the grid is nowhere to be seen..

据我所知,这是因为ScriptManager的犯规做标准回传这样浏览器犯规意识到发生了什么。

i understand that this is because of the scriptmanager doesnt do 'standard' postbacks so the browser doesnt realise what has happened.

但是我已经设置将EnableHistory为True的ScriptManager

however i have set the EnableHistory to true in the scriptmanager

有一个简单的方法来获得这个记忆不失在UpdatePanel / ScriptManager的?

is there an easy way to get this to remember without dropping the updatepanel/scriptmanager?

也进一步复杂事物的scriptmanger / UpdatePanel的实际上是在一个母版页。所以真的不知道我怎么可以让导航位在ScriptManager的工作.. 显然我有点confuised和任何帮助,有人可以提供将愉快地接受

also to complicate things further the scriptmanger /updatepanel is actually in a master page. so not really sure how i can get the navigate bits to work in the scriptmanager.. clearly i am a bit confuised and any help that someone could provide would be happily received

谢谢 NAT

推荐答案

设置EnableHistory只告诉ScriptManager的是为你准备好使用的服务器端支持。它仍然是由你来告诉ScriptManager的如何实际使用它。这不要紧,在UpdatePanel是一个母版。同去使用ScriptManager。只要你可以让你通过一个公共属性/的FindControl需要的参考,你会没事的。我已经做了好几次使用ScriptManager在母版和处理事件

Setting EnableHistory only tells the ScriptManager to be ready for you to use the server-side support. It is still up to you to tell the ScriptManager how to actually work with it. It doesn't matter that the UpdatePanel is on a MasterPage. Same goes with the ScriptManager. As long as you can get the references you need via a public property / FindControl, you'll be fine. I've done this several times with the ScriptManager in the MasterPage and handling the event

下面是一个的博客文章我大约2年前写的。这是一个有点过时了,你不需要扩展preVIEW,但其余的应该是相关的就够了。当你在一个异步回发,并结合GridView控件,必须添加州的历史点,并让ScriptManager的存放。这是在那里你会冻结过滤器的状态。然后,你还需要有一个事件处理程序的导航事件。这是你拉的状态出来了,用它来设置控件应该是什么,并绑定你的网格。

Here is a blog post I wrote about 2 years ago. It is a bit out of date as you don't need the Extensions Preview, but the rest should be relevant enough. When you are in an async postback and binding the gridview, you have to add state to a history point, and let the ScriptManager store it. This is where you would freeze the state of the filters. Then, you also need to have an event handler for the Navigate event. This is where you pull the state out, use it to set controls to what they should be, and bind your grid.

在code样品在vb.net,但请让我知道,我可以转换为C#。

The code samples are in vb.net, but please let me know and I can convert to c#.

阅读全文

相关推荐

最新文章