How to open new browser window on button click event?

后端 未结 4 1305
误落风尘
误落风尘 2020-12-31 09:25

How to open new browser window on button click event in C# ASP.NET?

Please share any example.

I am doing following code. Please let me know where I am going

4条回答
  •  醉梦人生
    2020-12-31 09:44

    You can use some code like this, you can adjust a height and width as per your need

        protected void button_Click(object sender, EventArgs e)
        {
            // open a pop up window at the center of the page.
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'your_page.aspx', null, 'height=700,width=760,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);
        }
    

提交回复
热议问题