This is a migrated thread and some comments may be shown as answers.

radMenu and popup windows changing focus

6 Answers 134 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ken De Vries
Top achievements
Rank 1
Ken De Vries asked on 18 Feb 2011, 10:57 AM
I just upgraded my rad controls for AJAX.

I have a GridView with a radMenu embedded in it.  it uses the following code to popup a window...

RadMenuItem DetailsMI = new RadMenuItem("Properties", string.Empty);
DetailsMI.ImageUrl = "images/Details.gif";
DetailsMI.Attributes["onclick"] = string.Format("javascript:PT_ViewPage('{0}'); return(false);", DetailsURL.ToURL());
Menu.Items.Add(DetailsMI);

The JavaScript PT_ViewPage looks like this...

function PT_ViewPage(TargetURL) {
    WindowArray[WindowArray.length] = window.open(TargetURL, "", "width=900, height=800, status=no, scrollbars=yes, resizable=yes");
}

Nothing fancy here.  The problem is that before the Teleric update, the child window that is opened used to remain on top - it retained focus.  After the update, focus shifts back to the parent window.

My question is:  What changed and how do I get the windows to behave like it used to???

6 Answers, 1 is accepted

Sort by
0
Ken De Vries
Top achievements
Rank 1
answered on 18 Feb 2011, 11:02 AM
Sorry, it is a radContextMenu.  Here is the ASPX markup...

<asp:TemplateField ShowHeader="false"  ItemStyle-Width="5%"  ItemStyle-HorizontalAlign="Right">
      <ItemTemplate>
        <asp:Image ID="btnPopup" runat="server" ImageUrl="images/Expand.jpg"   />
        <telerik:RadContextMenu 
            ID="mnuRow" 
            runat="server" 
            OnItemClick="ControlContextMenu_Click" 
            OnClientItemClicking="OnDeleteItemClicking" 
            CollapseAnimation-Duration="100" 
            ExpandAnimation-Duration="100" 
            ExpandDelay="0" 
            >
        <Targets>
            <telerik:ContextMenuControlTarget ControlID="btnPopup" />
        </Targets>
        </telerik:RadContextMenu>
    </ItemTemplate>
    </asp:TemplateField>    
0
Kate
Telerik team
answered on 23 Feb 2011, 03:27 PM
Hello Ken De Vries,

I tried to reproduce the issue that you encounter but with no success. Can you send us a sample running project with the problem that you describe?

Kind regards,
Kate
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Jay
Top achievements
Rank 1
answered on 17 Oct 2012, 02:07 AM
Has this been answered? I am hitting the same problem ... setting the .Attributes["onclick"] = "open some popup" ...   causes the popup to not get focus. It seems like the focus shifts back to the parent window ... effectively hiding the popup window.

Is there a workaround to this behavior (I simply want a RadMenuItem to open a popup when clicked).

Thanks
0
Princy
Top achievements
Rank 2
answered on 17 Oct 2012, 10:31 AM
Hi,

I suppose you want to open a radwindow on clicking menu item. Here is the sample code.
C#:
protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
{
    if (e.Item.Text == "open")
    {
        string script = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
        ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
    }
}

Thanks,
Princy.
0
Jay
Top achievements
Rank 1
answered on 17 Oct 2012, 05:11 PM
I am actually just trying to run some JavaScript to do a window.open. Your sample looks like a server post-back. Is there a way to simply run JavaScript to do a window.open without using postbacks and without the RadMenu control "stealing focus" after the JS runs?
Thanks
0
Princy
Top achievements
Rank 2
answered on 18 Oct 2012, 05:13 AM
Hi,

You can try the following client side approach.
JS:
function OnClientItemClicked(sender, args) {
    if (args.get_item().get_text() == "open")
      {
    var window = $find('<%= RadWindow1.ClientID %>').show();
    }
}

Thanks,
Princy.
Tags
Menu
Asked by
Ken De Vries
Top achievements
Rank 1
Answers by
Ken De Vries
Top achievements
Rank 1
Kate
Telerik team
Jay
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or