Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Command Button to Open Window

Reply
Thread Tools

Command Button to Open Window

 
 
Softworks
Guest
Posts: n/a
 
      01-11-2007
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


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      01-27-2007
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.

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net


"Softworks" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
suppress opening command window after using os.system command boriq Python 4 06-12-2008 10:42 AM
How can I get a non 25x80 command window when I use the "at" command on XP? Please Computer Support 4 02-14-2007 12:01 AM
Make an HTML button look like WebControl command button jimryder@gmail.com ASP .Net 0 07-20-2006 08:05 AM
window.open() doesn't open new Window in Opera PC HUA Javascript 2 05-19-2004 02:29 AM
close window click event for command button =?Utf-8?B?UGF1bA==?= ASP .Net 2 05-11-2004 10:01 PM



Advertisments