Command Button to Open Window

S

Softworks

I have a GridView that contains an command button in one of the columns.
The code-behind does some processing of code and then needs to open a
window.

It looks like the postback fires before the PopUpWindow. Is there anyway
around this?


Private Sub dgJobs_CancelCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgJobs.CancelCommand

-- code here to do some data manipulation

Dim url As String = "Viewer.aspx?docName=" & JobID

PopUpWindow(Url)

End Sub

Private Sub PopupWindow(ByVal url As String)

Dim script As String = String.Format("<script
language='javascript'>window.open('{0}', '_blank');</script>", url)

RegisterStartupScript("OpenWindow", script)

End Sub



Thanks in advance!

Tina
 
T

Teemu Keiski

If you are indeed specifying the code to trigger the oipning of the window,
it is natural that postbacking must happen first...

Other ways:

- Use UpdatePanel from ASP.NEt Ajax to "hide" the postback (if you use
ASP.NET 2.0)
.. Create & attach the opening script into onclick attribute of the rendered
ImageButton when you could open the window without a postback. ,As you are
taking some data from a datanound contro, (per row), you provbably could
create the script in ItemDataBound event already.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top