【发布时间】:2015-05-11 01:55:36
【问题描述】:
我在Page_Load()中注册了以下JavaScript:
var scriptReihe = "<script type=\"text/javascript\">function OnClientLoadHandlerReihe(sender) {"
+ "var listbox = $find(\"" + lbReihen.ClientID + "\");"
+ "var item = listbox.get_selectedItem();"
+ "item.ensureVisible();"
+ "}"
+ "</script>";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OnClientLoadHandlerReihe", scriptReihe);
lbReihen.OnClientLoad = "OnClientLoadHandlerReihe";
其中lbReihen 是RadListBox
这很好用,selectedItem 位于列表框的可见区域。
在页面上,还有一个按钮:
<asp:Button ID="myBtn" runat="server" Text="Call google" OnClientClick="window.open('http://www.google.ch', '_blank');" />
现在的问题是,当单击按钮并打开新页面(在新选项卡中)时,我的 ListBox 被阻止。我无法在其中滚动等等。
当我没有为 OnClientLoad 注册 EventHandler 时,一切正常。
谁能给我一个提示,有什么问题吗? - 谢谢。
【问题讨论】:
-
您真的需要确保所选项目在列表框中可见吗?这不是默认行为吗?乍一看,代码对我来说很好
标签: javascript asp.net telerik telerik-ajax telerik-radlistbox