I have a Gridview control in asp.net with C#.
In my application when I press the edit button from Gridview I need to open the information in another window. At this moment I use ‘Response.Redirect("..")’ but it opens in the same window.
I’ve tried:
protected void OutputGridView_RowEditing(object sender, GridViewEditEventArgs e)
{
outputGridView.EditIndex = e.NewEditIndex;
GridViewRow row = outputGridView.Rows[outputGridView.EditIndex];
string url = "http://localhost/MyPage.aspx";
Response.Write("<script>");
Response.Write("window.open('" + url + "')");
Response.Write("<" + "/script>")
e.Cancel = true;
}
But with no luck.
What’s the best way to do this?
This code will open the window in new window. for this you need to use the ScriptManager