how to open new browser when i click button

  1. #1

    how to open new browser when i click button



    Hi All,


    I can try to open new browser when i click a button (In cs File).for that i can write
    the following javascript function in button click event.but it is not working
    in coolite button click event.but it will work in asp button click event..


    why it will happen like this ...i want to open a new browser when i click button
    (in coe behind) of coolite button..plz give me reply as soon as possible..



    Thanks in Advance....

    <U>In Asp button click...</U>



    protected void Button1_Click(object sender, EventArgs e)
        {
            string script = "window.open('http://localhost:1389/test/Accounts/Default2.aspx');";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "OpenPage", script, true);
        }
    <U>In coolite Button Click...

    </U>
    protected void btnEdit_Click(object sender, AjaxEventArgs e)
            {
               
                string script = "window.open('http:\\SignIn.aspx',target='_blank');";
    
    
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "OpenPage", script, true);
            }
  2. #2

    RE: how to open new browser when i click button

    The following sample demonstrates opening from server-side and client-side.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            string script = "window.open('http://www.google.com/', 'myNewWindow')";
            this.Button1.AddScript(script);
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Button ID="Button1" runat="server" Text="Open 1" OnDirectClick="Button1_Click" />
            <ext:Button ID="Button2" runat="server" Text="Open 2" OnClientClick="window.open('http://www.google.com/', 'myNewWindow2');" />
        </form>
    </body>
    </html>
    Hope this helps.

    Geoffrey McGill
    Founder
  3. #3

    RE: how to open new browser when i click button


    Thank you very much ....it will work fine..


    But i have small question how can we add Ext.net name space....plz tell me..
  4. #4

    RE: how to open new browser when i click button

    Dinesh.T (3/23/2010)
    Thank you very much ....it will work fine..


    But i have small question how can we add Ext.net name space....plz tell me..
    The Ext.Net namespace will be available with the upcoming v1.0 release.


    Geoffrey McGill
    Founder
  5. #5

    RE: how to open new browser when i click button

    Ok Fine..


    Thankyou for your reply

Similar Threads

  1. open a asp:gridview footer on ext add button click
    By landerajshree in forum 1.x Help
    Replies: 0
    Last Post: Jun 28, 2012, 11:35 AM
  2. [CLOSED] When button click, open the menu of button
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 22, 2012, 4:23 PM
  3. open new browser tab by click on grid view
    By vahid.ch in forum 1.x Help
    Replies: 1
    Last Post: Dec 19, 2011, 8:36 AM
  4. [CLOSED] Open a browser window from a DirectEvent
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 07, 2010, 6:55 PM
  5. [CLOSED] Open new Browser Window from AjaxEvent
    By martin.mosimann in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 27, 2009, 9:54 AM

Posting Permissions