Button post back.........

J

John

I have attached the java script code to Button web control as follows.

myButton.Attributes.Add("OnClick", "OpenWindow()")

I have written java script to open the window in the OpenWindow function.

When I click on the myButon, new window will open and at the sametime
button is posting back the form(?) and the main window comes up and the
opened window goes behind. So that my purpose of displaying the data(window)
is lost. how to make sure that the opened window will remain on top in the
clicked event of button.
Thanks
john
 
G

Gönen EREN

Hi John,

Here is your answer...

In the popup window put the fallowing in the body tag :

onblur="window.focus()"


You'll see the result is better then you think. =)

Gönen.
 
Joined
Jul 19, 2006
Messages
1
Reaction score
0
Interesting answer Gönen but it didn't work for me.

Here is what I did:

Code:
protected override void Render(HtmlTextWriter writer)		
{
[INDENT]base.Render(writer);

// The code had to be placed here so that the new window would 
// remain on top.
if (this.IsPostBack && this.IsValid)
	Response.Write("<script>OpenWindow();</script>");[/INDENT]}

Also the OpenWindow function needs to set the focus to the new window (i.e. newWin.focus();)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top