Base solution for your next web application
Open Closed

Opening Link from Menu in New Window/TAB #2244


User avatar
0
fahd created

Hi, a Normal Menu link

url: "CRs/KPIs/BrandKPI/report.aspx",

i need to open the link in new tab, not to open in same window.

thank you for your support in advance


6 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You can add target="_blank" to the menu item (<a class="postlink" href="http://www.w3schools.com/tags/att_a_target.asp">http://www.w3schools.com/tags/att_a_target.asp</a>). To do that;

    In the menu rendering code (depends on which version you're using. for example for angularjs, it's here: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Web/App/common/views/layout/sidebar.cshtml">https://github.com/aspnetzero/aspnet-ze ... bar.cshtml</a>) just add target attribute conditionally.

    If you want to generalize it, you can add a CustomData while defining a menu item. Then you can check this custom data in the menu rendering code.

    I think this would be a general requirement and added a Github issue to add it as a standard property: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1737">https://github.com/aspnetboilerplate/as ... ssues/1737</a>

  • User Avatar
    0
    fahd created

    Hi, i was not sucessful in implementing this, it gives error.

    can you please help me see the correct script using this example?

    url: "CRs/KPIs/BrandKPI/report.aspx",

    <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Web/App/common/views/layout/sidebar.cshtml">https://github.com/aspnetzero/aspnet-ze ... bar.cshtml</a>

    this link is not functional.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Fahd,

    Can you share your github username with us ? We will invite you to private repository, then you will be able to see that link.

    Thanks.

  • User Avatar
    0
    fahd created

    fahdneo

    thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    You are invited. Now you should be able to see that link after accepting the invitation.

  • User Avatar
    0
    fahd created

    done

    thank you for the world class support.