how to code classic asp.net to open multiple browser instances (pages)

Coreysan 1,696 Reputation points
2024-08-29T05:22:23.5866667+00:00

I am working with .Net 4.0, where a user can see records in a GridView. What Im after is this:

  1. User has access to the Gridview on the main page.
  2. He clicks on a linkbutton from the gridview that launchers another browser instance (page 2).
  3. He clicks on yet another linkbutton from the gridview that launches another browser instance (page 3).
  4. Now that there are 3 browser instances, he can minimize, resize, etc. to compare all the details from pages 2 and 3, for example.

Can that be done with v4.0, with as little javascript as possible?

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,459 questions
{count} votes

Accepted answer
  1. Lan Huang-MSFT 29,246 Reputation points Microsoft Vendor
    2024-08-29T06:41:47.44+00:00

    Hi @Coreysan,

    You can try the code below.

    <asp:TemplateField>
         <ItemTemplate>
            <asp:LinkButton Text="view1" ID="lnkView1" runat="server" OnClientClick="multiopen1()" />
         </ItemTemplate>
     </asp:TemplateField>
     <asp:TemplateField>
         <ItemTemplate>
            <asp:LinkButton Text="view2" ID="lnkView2" runat="server" OnClientClick="multiopen2()" />
         </ItemTemplate>
     </asp:TemplateField>
    
    <script type="text/javascript">
        function multiopen1() {
            window.open('WebForm2.aspx', '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
        }
        function multiopen2() {
            window.open('WebForm3.aspx', '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
        }
    </script>
    

    User's image

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. SurferOnWww 2,661 Reputation points
    2024-08-29T05:49:26.2933333+00:00

    Use the HyperLinkFiled instead of LinkButton and set its Target property as needed.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.