简体   繁体   English

在EWL中,使用不同的查询参数导航到同一页面时如何清除滚动位置?

[英]In EWL, how do I clear scroll position when navigating to the same page with different query parameters?

I am on MyPage.aspx?questionNumber=1 and I am navigating to MyPage.aspx?questionNumber=2. 我在MyPage.aspx?questionNumber = 1上,并导航到MyPage.aspx?questionNumber = 2。 I am using this code create the navigation between the two: 我正在使用此代码创建两者之间的导航:

EwfUiStatics.SetContentFootActions( new ActionButtonSetup( "Next",
                                                                           EwfLink.Create(
                                                                               new Info( es.info, new OptionalParameterPackage { QuestionNumber = info.QuestionNumber + 1 } ),
                                                                               new ButtonActionControlStyle() ) ) );

Notice I am using "new Info" and re-using the entity's info object. 注意,我正在使用“新信息”并重新使用实体的信息对象。 Maybe I should be using GetInfo or something else, instead. 也许我应该使用GetInfo或其他方式。

When I get to the next question, I am scrolled halfway down the page. 当我转到下一个问题时,我向下滚动到页面的一半。 I want to be at the top. 我想成为顶级。 How do I force the scroll position to be cleared (or more generally, how do I specify the info object so that I don't have undesired carry-over from the previous page)? 如何强制清除滚动位置(或更笼统地说,如何指定信息对象,以免上一页没有不希望的残留物)?

The way you navigate (including whether you reuse Info objects or not) makes no difference in what is retained. 导航方式(包括是否重复使用Info对象)在保留内容方面没有任何区别。 Even something like this (in a DataModification ) would produce the same results you're seeing: 甚至像这样(在DataModification )也会产生与您看到的相同的结果:

parametersModification.QuestionNumber += 1;

Currently EWL does not have strong support for picking and choosing the state you want to retain after an intra-page navigation. 当前,EWL在页面内导航后没有强烈支持选择和选择要保留的状态。 But for scroll position in particular, you may be able to override EwfPage.scrollPositionForThisResponse to get what you want. 但是特别是对于滚动位置,您可以重写EwfPage.scrollPositionForThisResponse以获取所需的内容。 You could unconditionally return ScrollPosition.TopLeft as long as the page never does post backs in which you want to retain scroll position. 您可以无条件返回ScrollPosition.TopLeft ,只要页面从不回发保留滚动位置的背景。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在EWL中,如何在页面的任意位置显示自定义验证内容? - In EWL, how do I show custom validation content at an arbitrary place in the page? 如何在 EWL 中的请求中缓存某些内容? - How do I cache something within a request in EWL? 如何在EWL中创建和部署Windows服务? - How do I create and deploy a Windows service in EWL? 如何在EWL中正确设置表单身份验证? - How do I properly set up forms authentication in EWL? 离开一页时如何清除会话 - How to clear Session when navigating away from one page 即使从不同的 Y position 开始,如何使跳跃达到相同的高度? - How do I make a jump reach the same height even when starting from a different Y position? 我需要做什么才能使EWL快捷方式URL起作用? - What do I have to do to get EWL Shortcut URLs to work? 如何在EWL中将表单字段的焦点设置为页面加载? - How to set form field focus on page load in EWL? 导航时如何重新加载页面 - How to reload page when navigating 如何加载相同的 Blazor 页面并使用不同的参数访问相同的 url 并将参数显示到 Blazor 中的 UI? - How can I load the same Blazor page hitting same url with different parameters and show the parameter to UI in Blazor?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM