1

I have a dynamically generated menu (C#), like this:

MenuItem(string text, string value, string imageUrl, string navigateUrl, string target)

MenuItem AdminLevel1 = new MenuItem("Admin", "Admin"); MenuItem AdminPedidosRegisto = new MenuItem("Questions", "AdminQ");
NavigationMenu.Items.Add(new MenuItem("Messages Received", "AdminMessagesR", "", "./Admin/Messages.ascx", "ContainerIframe")); AdminPedidosRegisto.ChildItems.Add(new MenuItem("Pending", "AdminPending", "", "./Admin/Pedidos.ascx", "ContainerIframe"));

Where 'ContainerIframe' is the iFrame's ID and 'NavigationMenu' is the (asp:Menu)'s ID.

I want the URL in navigateUrl to open in an iFrame. Is that possible? If i set the iFrame's ID in the target parameter, in google chrome it works fine, but not in the other browsers. Is there a way?

4

1 回答 1

0

Use the name of the iframe and not the id to archive that, to load the page inside the iframe.

eg:

<iframe src="whatever.htm" id="whateverid" name="ContainerIframe"></iframe>

You can have the same id and name, but the important here is the name

Here is an iframe test that work: http://jsfiddle.net/7AMjy/3/

于 2012-12-13T11:59:21.977 回答