Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > MessageBox not showing before Response.Redirect

Reply
Thread Tools

MessageBox not showing before Response.Redirect

 
 
Xarky
Guest
Posts: n/a
 
      04-21-2005
Hi,
I am showing a messagebox with the following method:

public static void ShowMessageBox(HtmlTextWriter htmlTextWriter,
string message)
{
htmlTextWriter.Write("<script
language=JavaScript>window.alert('"+message+"');</script>");
htmlTextWriter.Flush();
} // end method showMessageBox


Now I am calling it with the following way:

HtmlTextWriter htmlTextWriter;
htmlTextWriter = this.CreateHtmlTextWriter(Context.Response.Output) ;
ShowMessageBox(htmlTextWriter, "Hello.");

When I add Response.Redirect(...), message box is not being shown
while when I do not set Respones.Redirect, it works.

Is there a way how I can solve this problem.
Thanks in Advance
 
Reply With Quote
 
 
 
 
Elton W
Guest
Posts: n/a
 
      04-21-2005
Hi Xarky,

In order to show message box then redirect to other page,
you should use client-side redirect rather than server-
side Redirect (Response.Redirect).

For example,

RegisterStartupScript("redirect", "<script
language=JavaScript>alert('Message'); open
('http://www.yahoo.com');</script>")

Show Message first. Once click OK it opens yahoo page in
new window. If you want to keep new page in same window,
you need more javascript code.

HTH

Elton Wang
http://www.velocityreviews.com/forums/(E-Mail Removed)



>-----Original Message-----
>Hi,
>I am showing a messagebox with the following method:
>
>public static void ShowMessageBox(HtmlTextWriter

htmlTextWriter,
>string message)
>{
> htmlTextWriter.Write("<script
>language=JavaScript>window.alert

('"+message+"');</script>");
> htmlTextWriter.Flush();
>} // end method showMessageBox
>
>
>Now I am calling it with the following way:
>
>HtmlTextWriter htmlTextWriter;
>htmlTextWriter = this.CreateHtmlTextWriter

(Context.Response.Output);
>ShowMessageBox(htmlTextWriter, "Hello.");
>
>When I add Response.Redirect(...), message box is not

being shown
>while when I do not set Respones.Redirect, it works.
>
>Is there a way how I can solve this problem.
>Thanks in Advance
>.
>

 
Reply With Quote
 
 
 
 
xarky d_best
Guest
Posts: n/a
 
      04-22-2005

Hi,
I require to open the new page in the same window.


*** Sent via Developersdex http://www.developersdex.com ***
 
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
Sh Crypto isakmp sa is showing Active but Tunnel is showing line protocol down. urvin Cisco 0 04-15-2008 08:17 AM
MessageBox does not popup if using with Atlas on the web application Ted Ngo ASP .Net 0 10-17-2006 03:55 PM
ASP 1.1: DataGrid - Showing/Not Showing Buttons Ray Booysen ASP .Net 2 03-28-2006 02:49 PM
Howto load a file BEFORE showing a htm object ? Alex Nitulescu ASP .Net 1 03-21-2005 07:32 AM
Validation Summary Control not displaying MessageBox Chris Lane ASP .Net Web Controls 11 11-24-2003 06:58 PM



Advertisments