---
title: "实现Response.Redirect能在新窗口中打开的方法"
author: "daweijsp"
date: "2009-03-05T13:36:03Z"
tags: [".net", "ASP", "ASP.net", "C", "C++"]
slug: "response-redirect"
draft: false
lastmod: "2009-03-05T13:36:03Z"
id: 343779
url: "https://daweijsp.iteye.com/blog/343779"
---

```
C#
```

```
//当点击搜索按钮时在新窗口中打开
btnSearch.Attributes.Add("onclick", "this.form.target='_newName'");
```

  在ASP.NET中，给BUTTON控件里的事件加上Response.Redirect...页面会在当前的页面打开，如果想要让在新窗口中打开的话只需要在Page\_Load事件中加上如下代码即可：