How to open top window (include the frameset) in parent window? Thanks a lot!

angel_lee 2006-09-02 06:14:44
Scenario below:
I have a .asp window A (here we call it parent window)which contains a frameset. (actually it sometimes contain frameset, sometimes do not contain frameset.) A includes a header file we call it TopBar.asp.

I have a asp.net window B (we call it child window), it has a lot of different URL links on window B. When I click each of the links, they will open in page A.

It didn't works if I use target="_parent" in window B. So I give a name "aaa" to TopBar, then set target="aaa" and open the links in window A.

Question:
How could I open the links in window A from Top window in .net? Since my .net code do not have <a href ...> or anything like asp.

(I could not put the page "aaa" in frameset, since sometimes the window do not have frameset)

I am not sure if I make sense. Please let me know if it has any questions. Thanks a lot!
...全文
616 27 打赏 收藏 转发到动态 举报
写回复
用AI写文章
27 条回复
切换为时间正序
请发表友善的回复…
发表回复
redleaf80 2006-09-06
  • 打赏
  • 举报
回复
caizhenfang(午夜屠猪男):
you can't do nothing means you can do anything
angel_lee 2006-09-06
  • 打赏
  • 举报
回复
To Santos(快乐的GG),
I may control target = "_parent", but it can only open in current window, not in parent window.


To Knight94(愚翁),

My current window is .net code, my links is bound to GridView, not asp code.

<asp:HyperLink ID="hyperLinkResult" runat="server" Text='<%# getSubString(Eval("resultName").ToString()) %>' NavigateUrl='<%# String.Format(Eval("resultUrl").ToString(), Eval("resultName"))%>' Target='<%# getTargetString(Eval("resultUrl").ToString()) %>' />


protected string getTargetString(string rstUrl)
{
string targetStr = "aaa";
if (rstUrl.Substring(14, 18) == "repositoryFile.asp")
{
targetStr = "_new";
}
return targetStr;
}
angel_lee 2006-09-05
  • 打赏
  • 举报
回复
To Knight94(愚翁),

I am not quiet clear with the js codes in page b.html which you recommand to me.
I just start to learn javascript.

What's your sentence mean?

"Use js in asp page to handle link-click event of sub-page."

"you implement the link-click event in parent page, and submit them from sub-page."

is this two sentence conflict?

The "sub-page" you mention here is a .net page, and all my links is on this page.
Santos 2006-09-05
  • 打赏
  • 举报
回复
could you control, use target="aaa" when your parent form contain frameset, or use target = "_parent" when your parent form do't contain frameset?

if you could, this problem become easy.

good luck!
terryghz 2006-09-05
  • 打赏
  • 举报
回复
Great job!!
Knight94 2006-09-05
  • 打赏
  • 举报
回复
Sample code as follows:
//Add js function in parent page
<script language="javascript">
function LinkClicked( strURL )
{
window.location.href=strURL;
}
</script>

//in sub-page
<script language="javascript">
function LinkClicked( strURL )
{
window.parent.LinkClicked( strURL );
}
</script>
<!--
Add link as follows
By the way, you can created URL parameter in server-side for function named "LinkClicked"
-->
<asp:HyperLink ID="lnkParentURL" runat="server" NavigateUrl="#" onclick="LinkClicked('http://www.google.com')">MyTest</asp:HyperLink>
angel_lee 2006-09-04
  • 打赏
  • 举报
回复
To Knight94(愚翁),

Go to this page and mark there, I may share some points to you. :)

they did help me something, but didn't solve the issue.

http://community.csdn.net/Expert/topic/4985/4985970.xml?temp=.8155176
angel_lee 2006-09-04
  • 打赏
  • 举报
回复
To: you implement the link-click event in parent page, and submit them from sub-page.

Answer: Not really, I implement the link-click event in my .aspx page(current .net page). I submit my links in parent window (asp page), since I would like to keep my search results (that shows as links), .net page there, so that the user may go ahead to use all the other links as their requirement.

Knight94 2006-09-04
  • 打赏
  • 举报
回复
to I've tried target="_top", it didn't work.

It looks weird.

For method 2, you should read the follow article
ref:
http://community.csdn.net/Expert/TopicView3.asp?id=4967911

you implement the link-click event in parent page, and submit them from sub-page.
angel_lee 2006-09-03
  • 打赏
  • 举报
回复
Thanks Knight94(愚翁)!

I've tried target="_top", it didn't work.

For the other two method, I am not quite clear with your meaning.

My current window is a .net page, do not have frameset. But my parent window is asp page , will display all kind of asp result page. (some of the pages have frameset, some of the page do not have frameset.)

Actually I am more interested in your method2, could you please explain it or give me an example? Thanks a lot!
zpengenpz 2006-09-03
  • 打赏
  • 举报
回复
up
Knight94 2006-09-03
  • 打赏
  • 举报
回复
to Set target="_top" can open the page in current .net window. But I would like to open the page in parent .asp window.

I guest "_top" is enough. Have a try!

Other ways:
Method1:
As opening a page from asp, pls add some parameters to indicate whether current sub-page is made up of framesets or not. And then set target according to the parameters.

Method2:
Use js in asp page to handle link-click event of sub-page.
angel_lee 2006-09-02
  • 打赏
  • 举报
回复
To: actually it sometimes contain frameset, sometimes do not contain frameset

Please read the scenario carefully. Parent window is only a window, but i want to open all kinds of links (or pages) in this window. Since I don't want to open too much windows in screen. So some of the pages have frameset, some of the pages do not have frameset.

For those pages which have frameset, my URL which was used to open the page pointed to one of a frame in the frameset, but I hope I can open the page with frameset. This means open top window.

Does I make sense?

Thanks a lot!
三省Ta叔 2006-09-02
  • 打赏
  • 举报
回复
I can't do nothing but only 接分
都不知道这个写对了不
angel_lee 2006-09-02
  • 打赏
  • 举报
回复
Set target="_top" can open the page in current .net window. But I would like to open the page in parent .asp window.
geoffe 2006-09-02
  • 打赏
  • 举报
回复
你的问题如果用汉语写的话
早就应该有满意的答案了
怎么非要用影格你齐呢

众生呼之即来
一切随风而逝
fds2003 2006-09-02
  • 打赏
  • 举报
回复
看来,现在帮人杰解决问题,英文都要好才行呀!
jijl2001 2006-09-02
  • 打赏
  • 举报
回复
楼上正解,设置链接的target属性为 _top
Knight94 2006-09-02
  • 打赏
  • 举报
回复
To set target with "_top" is appropriate for both conditions.
sswwee 2006-09-02
  • 打赏
  • 举报
回复
唉,留过洋的人就是不一样
加载更多回复(7)

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧