J
Jason
Hi,
Here's the scenario:
I have a web application that has window A and window B.
A user has both window A and B open - window A is in the foreground and
window B is behind it.
If the user looking at window A clicks the "open window B" link, I want
window B to come to the front.
My approach was to set the window B Body tag's onload event like so:
<body onload="window.focus()">
I also want to place the default focus in the first text box in window B. I
was doing this like so:
protected void Page_Load(object sender, EventArgs e)
{
this.txtUserName.Focus();
}
The problem is, I can't seem to successfully use both of these at the same
time.
this.txtUserName.Focus() only works when I don't specify the onload() event
for the body tag.
I should note that window.focus() in the body tag's onload event fires
successfully whether this.txtUserName.Focus() is specified or not.
Not sure if it's pertinent, but Window B is a content page that has a master
page that is in turn a content page for another master page (aka, a nested
master page).
I have tried using
Page.Form.DefaultFocus = txtUserName.ClientID;
as well, but to no avail.
Any ideas are greatly appreciated!
Jason
Here's the scenario:
I have a web application that has window A and window B.
A user has both window A and B open - window A is in the foreground and
window B is behind it.
If the user looking at window A clicks the "open window B" link, I want
window B to come to the front.
My approach was to set the window B Body tag's onload event like so:
<body onload="window.focus()">
I also want to place the default focus in the first text box in window B. I
was doing this like so:
protected void Page_Load(object sender, EventArgs e)
{
this.txtUserName.Focus();
}
The problem is, I can't seem to successfully use both of these at the same
time.
this.txtUserName.Focus() only works when I don't specify the onload() event
for the body tag.
I should note that window.focus() in the body tag's onload event fires
successfully whether this.txtUserName.Focus() is specified or not.
Not sure if it's pertinent, but Window B is a content page that has a master
page that is in turn a content page for another master page (aka, a nested
master page).
I have tried using
Page.Form.DefaultFocus = txtUserName.ClientID;
as well, but to no avail.
Any ideas are greatly appreciated!
Jason