Command Button to Open Window



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

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

-- code here to do some data manipulation

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


End Sub

Private Sub PopupWindow(ByVal url As String)

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

RegisterStartupScript("OpenWindow", script)

End Sub

Thanks in advance!




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