开发者

How to redirect from user control placed in iframe?

I have a user control with following hyperlink:

<asp:HyperLink ID="MakeOrderLink" runat="server" onclick="return MakeOrderLink_onClick(this);" />

javascript function redirects based on provided parameters to another page

function MakeOrder_onClick(sender) {
//param1, param2 

document.location.href = sender.href + '&count=' + param1 + '&date=' + param2;
return false;
}

This user control is placed on .aspx page, which I need to provide as an iframe.

I need the page to open in new window.

MakeOrderLink.Target = "_blank" works when the control is placed only in .aspx page but I can not figure out how to redirect when it is nested two levels down (link inside user control contained in iframe contained in another .aspx page).

Any开发者_运维问答 suggestions? Thx


I do not quite understand your question, but I'll try to help.

If you have a hyperlink inside an iframe, and this hyperlink have to redirect the parent page (page that contains the iframe), you can use the parent javascript objetc to change the parent URL.

So, you can do this:

parent.document.location.href = sender.href + '&count=' + param1 + '&date=' + param2;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜