G
Guest
Hi there,
I have a form that contains a link button. When the user clicks the link
button I need to enable a couple of other buttons on the page and open a new
browser window giving it focus (keeping it on top). I have most of it working
but I can't get it all working. I can either have the window open and disable
the buttons with the new window in the background, or I can have the new
window in the foreground but not be able to disable the buttons. Here's why:
In the pageLoad of the main form, I add an onclick attribute to the link
button that creates the new browser window using window.open:
lbLinkButton.Attributes.Add("onclick", "var w=window.open('" &
"newPage.aspx" & "'); w.focus();")
When the user clicks on the link button, the window.open gets fired and then
the link button's click event fires and I enable the other buttons on my
page. The problem is that the new window appears on top for a brief period
then disappears to the background (I assume when the rest of the code behind
for the main form executes).
I was able to get the new browser window to stay in the foreground by adding
"return false" to the above attribute as in:
lbLinkButton.Attributes.Add("onclick", "var w=window.open('" &
"newPage.aspx" & "'); w.focus(); return false;")
The problem I now have with the return false is that execution doesn't
return to the main form's code behind; the link button's click event never
gets trapped.
Does anyone know of a solution to this problem?
Thanks,
Carlo.
I have a form that contains a link button. When the user clicks the link
button I need to enable a couple of other buttons on the page and open a new
browser window giving it focus (keeping it on top). I have most of it working
but I can't get it all working. I can either have the window open and disable
the buttons with the new window in the background, or I can have the new
window in the foreground but not be able to disable the buttons. Here's why:
In the pageLoad of the main form, I add an onclick attribute to the link
button that creates the new browser window using window.open:
lbLinkButton.Attributes.Add("onclick", "var w=window.open('" &
"newPage.aspx" & "'); w.focus();")
When the user clicks on the link button, the window.open gets fired and then
the link button's click event fires and I enable the other buttons on my
page. The problem is that the new window appears on top for a brief period
then disappears to the background (I assume when the rest of the code behind
for the main form executes).
I was able to get the new browser window to stay in the foreground by adding
"return false" to the above attribute as in:
lbLinkButton.Attributes.Add("onclick", "var w=window.open('" &
"newPage.aspx" & "'); w.focus(); return false;")
The problem I now have with the return false is that execution doesn't
return to the main form's code behind; the link button's click event never
gets trapped.
Does anyone know of a solution to this problem?
Thanks,
Carlo.