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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open new browser window with button link on datagrid 1

Status
Not open for further replies.

impulse24

IS-IT--Management
Jul 13, 2001
167
0
0
US
I have a webform where a user enters data in some field and a datagrid is populated with the results of the query. The datagrid contains 6 bound columns with values from a database. There is one button column which contains a view link.

When the user clicks the view link I am running a separate procedure to encrypt a url string with values from the grid. I dont want to run the procedure until the user actually clicks the link.

I then am using response.redirect with the encrypted url to go to a new site

Below is the code that is working currently:

Sub LinkClicked(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
If e.CommandName = "View" Then
Dim buttonColumn As TableCell = e.Item.Cells(1)
Dim SSNColumn As TableCell = e.Item.Cells(10)
Dim SSN As String
SSN = SSNColumn.Text
URLtoFWd = " URLtoencrypt="userid=test&password=test1&key1=SSN|" & SSN
EncryptedURL = encrypt(urltoencrypt)
Response.Redirect(URLtoFWd + encryptedurl)
End IF
End Sub

I want to open the url above in a new window. I think I need to use javascript, but am not sure how I can pass it the variable URL.

Any help would be greatly appreciated
 
instead of response.redirect, try:

Response.Write("<script language = javascript>window.open('" & URLtoFWd & "?" & encryptedurl & "'); </script>")
 
thanks so much mmaz, it worked like a charm. didnt know response.write did anything other than display on the current page.
 
Yeah that is cool, I just tested it. Never knew that could work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top