I register the following JavaScript in the Page_Load()
:
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";
where lbReihen
is a RadListBox
This is working great and the selectedItem
is in the visible area of the ListBox.
On the Page, there is also a button:
<asp:Button ID="myBtn" runat="server" Text="Call google" OnClientClick="window.open('http://www.google.ch', '_blank');" />
The problem is now, when the button will be clicked and the new page (in a new tab) will be opened, my ListBox is blocked after. I cannot scroll in it etc.
When I don't register the EventHandler for OnClientLoad
, all is working great.
Can someone give me a hint, what there is wrong? - Thanks.