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!

解决方案 »

  1.   

    楼主的英文实在让人头疼,“a .asp window”就一个window代表webform和winform了
      

  2.   

    actually it sometimes contain frameset, sometimes do not contain frameset
    --------------------------
    楼主这个是怎么回事啊?
      

  3.   

    How could I open the links in window A from Top window in .net?
    -----------------------------
    还有这个from top window,搞得一头雾水,请楼主介绍清楚
      

  4.   

    To set target with "_top" is appropriate for both conditions.
      

  5.   

    楼上正解,设置链接的target属性为 _top
      

  6.   

    Set target="_top" can open the page in current .net window. But I would like to open the page in parent .asp window.
      

  7.   

    I can't do nothing but only 接分
    都不知道这个写对了不
      

  8.   

    To: actually it sometimes contain frameset, sometimes do not contain framesetPlease 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!
      

  9.   

    make it sense?
    unfortunately, not yet
      

  10.   

    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.
      

  11.   

    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!
      

  12.   

    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=4967911you implement the link-click event in parent page, and submit them from sub-page.
      

  13.   

    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.
      

  14.   

    To Knight94(愚翁),Go to this page and  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
      

  15.   

    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.
      

  16.   

    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>
      

  17.   

    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!
      

  18.   

    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;
        }
      

  19.   

    caizhenfang(午夜屠猪男):
    you can't do nothing means you can do anything