Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open New Window from gridview button

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I have a datagridview with an imagebutton that will allow the user to select a record within the grid for editing purposes. I'm trying to open a new window instead of a response.redirect. see code below
The only way I can seem to get this to work is by using response.write. is there a better way to do this ? Thanks in advance

Protected Sub lnkEdit_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim lnkbtn As ImageButton = TryCast(sender, ImageButton)
Dim gvrow As GridViewRow = TryCast(lnkbtn.NamingContainer, GridViewRow)
Dim id As Integer = Convert.ToInt32(dg.DataKeys(gvrow.RowIndex).Value.ToString())

Session("id") = id

Response.Write("<script>")
Response.Write("window.open('Myform.aspx','_blank')")
Response.Write("</script>")

End Sub

 
Just attach a javascript call to the control you want to trigger the window.open
in that function set your options etc and call window.open()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top