[英]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.