Advertisement

03.20.2008 at 09:45AM PDT, ID: 23257529
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Problem with Response Redirect not closing the window.
Tags: ASP.Net, Microsoft, 2.0
Please see question: ID:23254044Author:tjgilbertDate:03.19.2008 at 10:48AM CDT

I am unable to get the window(form) to close using Response.Redirect.
I've even tried Server.Transfer but that didn't work either.

    Sub ConfirmYes(ByVal sender As Object, ByVal e As System.EventArgs)
        Session("Confirmed") = True
        msgLB.Visible = "true"
        Server.Transfer("RodData.aspx")
        Response.Write("<script language='javascript'> { window.close();}</script>")
        'Response.Redirect("RodData.aspx")
        'Response.RedirectLocation = Page.ResolveUrl("RodData.aspx")
    End Sub
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: tjgilbert
Solution Provided By: MaxOvrdrv2
Participating Experts: 2
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
03.20.2008 at 09:49AM PDT, ID: 21173305

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.20.2008 at 11:13AM PDT, ID: 21174064

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.20.2008 at 12:55PM PDT, ID: 21175194

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.20.2008 at 03:32PM PDT, ID: 21176545

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.21.2008 at 04:26AM PDT, ID: 21179139

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 07:06AM PDT, ID: 21193582

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 08:31AM PDT, ID: 21194198

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 02:19PM PDT, ID: 21206324

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 06:58PM PDT, ID: 21208247

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 07:00PM PDT, ID: 21208263

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 10:43AM PDT, ID: 21214289

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 06:48PM PDT, ID: 21217957

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.26.2008 at 06:50PM PDT, ID: 21217967

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 08:55AM PDT, ID: 21222763

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 01:24PM PDT, ID: 21225410

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 01:35PM PDT, ID: 21225487

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 05:16PM PDT, ID: 21226986

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 05:22PM PDT, ID: 21227014

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.31.2008 at 08:13AM PDT, ID: 21246095

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.20.2008 at 09:49AM PDT, ID: 21173305

Rank: Master

Its loically wroing
if once your close statement been exectulated it will not redirect to anywhere
but u dont need to close window anyway bcoze u gonna redirect it to other page which it self will open in the window and the old one is gonna close automatically
 
03.20.2008 at 11:13AM PDT, ID: 21174064
It doesnt' seem to work.  I think it's because I am redirecting to ConfirmLargeFile.aspx  from  DisplayDoc.aspx and then redirecting back to DisplayDoc.aspx from ConfirmLargeFile.aspx .  Then in  DisplayDoc.aspx  based upon the Session variable - well here is the code:
                  If Session("Confirmed") = False Then
                        Response.Redirect("Confirm.aspx")
                    End If
                    If (Session("Confirmed") = True) Then
                        Session("Confirmed") = False
                        Response.BufferOutput = True
                        Response.Clear()
                        Response.ContentType = "Application/doc"
                        Response.AddHeader("Content-Disposition", "inline;filename=new.doc")
                        Response.AddHeader("Content-Length", dr.Item("reportdata").length.ToString())
                        Response.BinaryWrite(dr.Item("reportdata"))
                        Response.End()

                    End If
                End If


 
03.20.2008 at 12:55PM PDT, ID: 21175194

Rank: Master

can u explain me something in detail with code
bcoze in you new code u are not using that window closing script anywhere
plz elobrate me the things

thanx
 
03.20.2008 at 03:32PM PDT, ID: 21176545
Okay, I decided to try something else

my javascript funtion:
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
      return true ;
else
      return false ;
}

in my Load_Page
 ClientScript.RegisterStartupScript(GetType(Page), "Script", "<script>confirmSubmit();</" & "script>")

How do obtain the value that calling confirmSubmit returns?

Thanks
 
03.21.2008 at 04:26AM PDT, ID: 21179139
put a hidden field on your form, then go like this:

if (agree)
      document.getElementById("<%=me.hiddenfieldname.clientID%>").value="true"
      return true ;
else
      document.getElementById("<%=me.hiddenfieldname.clientID%>").value="false"
      return false ;
}

then you can access that value in the code-behind... you can even put an @onchange@ event on the server object (hidden field) to fire up some back-end event once you've changed the value of the field.
 
03.24.2008 at 07:06AM PDT, ID: 21193582
<asp:TextBox ID="respTB" runat="server" text="false" Visible=false></asp:TextBox>

function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
     document.getElementById("<%=me.respTB.clientID%>").value="true"
      return true ;
else
     document.getElementById("<%=me.respTB.clientID%>").value="false"
      return false ;
}

When I added the document.get ElementById the funtion stopped working.  Is there a problem wit my syntax?
 
03.24.2008 at 08:31AM PDT, ID: 21194198
I added the correct syntax:

The confirm box is displaying but I noticed when I add
ClientScript.RegisterStartupScript(GetType(Page), "Script", "<script>confirmSubmit();</" & "script>")

 Response.Write("RespTB =" & respTB.Text)

The confirmSubmit is not occuring first.  How can I collect values when the code continues to process before I can get the values into the text box?

function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree){
     document.getElementById('respTB').value="true";
      return true ;
      }
else{
    document.getElementById('respTB').value="false";
      return false ;
   }
}

I appreciate any help you can give me.  This is not going well.

Thanks
 
03.25.2008 at 02:19PM PDT, ID: 21206324
All this is done in the Page_Load subroutine:
ClientScript.RegisterStartupScript(GetType(Page), "Script", "<script>confirmSubmit();</" & "script>")

If (javascript:confirmSubmit()) Then  ??????
                        Session("Confirmed") = False
                        Response.BufferOutput = True
                        Response.Clear()
                        Response.ContentType = "Application/doc"
                        Response.AddHeader("Content-Disposition", "inline;filename=new.doc")
                        Response.AddHeader("Content-Length", dr.Item("reportdata").length.ToString())
                        Response.BinaryWrite(dr.Item("reportdata"))
                        Response.End()
                    End If

How can I call the confirmSubmit() ?

I appreciate any suggestions you have.
 
03.25.2008 at 06:58PM PDT, ID: 21208247
the problem here is that a <ap:TextBox set Visible="False" will actually not get rendered when you run the page... that's why you're having problems... try creating a hidden field instead... and not a visible=false... 2 ways you can do that:

1) Code-Behind
Page.RegisterHiddenField("respTB", "false")
ClientScript.RegisterStartupScript(GetType(Page), "Script", "<script>confirmSubmit();</" & "script>")

2) in the .ASPX
<input type="hidden" id="respTB" runat="server">

i recommend the first  option... but the second will work just fine.
 
03.25.2008 at 07:00PM PDT, ID: 21208263
then you can reference the value of the field in the code-behind as you would any other normal field on the page:

if me.respTB.text="true" then
  ....
else
 ...
end if
 
03.26.2008 at 10:43AM PDT, ID: 21214289
Hi MaxOvdrv2 thank you for responding.

I went with <input type="hidden" id="respTB" runat="server">
because I got a complaint me.respTB that is was not defined.

The input doesn't have .text so I changed the line to

if Equals(respTB.value,"true") then  but it's never set to true?

do you see anything wronge with my function confirmSubmit()?
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree){
     document.getElementById('respTB').value="true";
      return true ;
      }
else{
    document.getElementById('respTB').value="false";
      return false ;
   }
}

Thank you for helping me!!
 
03.26.2008 at 06:48PM PDT, ID: 21217957
yes... again:
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree){
     document.getElementById('<%=respTB.ClientID%>').value="true";
      return true ;
      }
else{
    document.getElementById(<%=respTB.ClientID%>').value="false";
      return false ;
   }
}
 
03.26.2008 at 06:50PM PDT, ID: 21217967
you could also do this:

<input type="hidden" id="respTB" runat="server" value="false">
(make sure at this point that you switch to design view to register the control)

then in your codebehind

if me.respTB.value.toString()="true"  then
 
03.27.2008 at 08:55AM PDT, ID: 21222763
I put an else statment to see if what is happening.
Apparently the code is not waiting for the confirm results.
The confirm box appears and the code just keeps going.  Using the default false value.

Anyway to make the code stop to wait for the results of the confirm box?

Thanks
 
03.27.2008 at 01:24PM PDT, ID: 21225410
what is client side is always done first... therefore i don't see how this could happen?

did you use OnClientClick or OnClick?
 
03.27.2008 at 01:35PM PDT, ID: 21225487
The confirm text box appears when the RegisterStartupScript is being ran:
ClientScript.RegisterStartupScript(GetType(Page), "Script", "<script>confirmSubmit();</" & "script>")

but the rest of the  ASP.Net code is not stopping to wait for the results.

I am running this in Page_Load so I don't have any buttons.

What am I not understanding?
 
03.27.2008 at 05:16PM PDT, ID: 21226986
ok wait... you're doing the confirmsubmit on pageload?? why? it's gonna ask every time you load the page... even on postbacks??

in any case, the reason here is this:

PageLoad=ServerSide
RegisterScript=ServerSide

here's how it goes:

first things first:
Server Side Processes (pre-render, pageload, events, etc)

second thing:
Page.Render (server builds the HTML and client scripts)

third thing:
Client-Side scripts and HTML page is spit back to the user...

therefore, it's normal that your textbox isn't changed on page load, because it hasn't had a chance to be changed yet.

i,m guessing you're trying to ask the user something before anything gets done, correct? if so... here's what you do:

PageLoad()

if Page.IsPostback=false then
   RegisterStartupScript
end if

HTML:

<asp:button id="DoIt" runat="server" text="Nothing" style="visibility:hidden;" />

<script>
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree){
     document.getElementById('<%=respTB.ClientID%>').value="true";
      document.getElementById('<%=DoIt.ClientID%>').click();
      return;
      }
else{
    document.getElementById(<%=respTB.ClientID%>').value="false";
    document.getElementById('<%=DoIt.ClientID%>').click();
    return ;
   }
}

Back-End Event Handler:
Private Sub DoIt_Click(ByVal sender as Object, ByVal e as EventArgs) handles DoIt.Click
    DO THE CODE YOU WANT TO CHECK YOUR FIELD HERE!!!
End Sub


this way, the page will load the confirmation script once, not on postback, the script itself will change the field of your field and THEN click a hidden button, which will trigger a postback (therefore, script won't run again) and call the event handler for the hidden button and from there, your field will be changed and you can use it's content however you want.

let me know if this is what you want to do or not...

cheers!
Accepted Solution
 
03.27.2008 at 05:22PM PDT, ID: 21227014
Sorry... revised last paragraph, so you can understand better:

this way, the page will load the confirmation script one time only, then the script itself will change the value of your field and THEN also click a hidden button, which will trigger a postback, at this point, the script has had time to change the field value and NOW you can check it server-side... the event handler for the hidden button can handle it here, and in that event handler, you can do whatever you want with the field value.

maybe this is a bit more clear.
 
03.31.2008 at 08:13AM PDT, ID: 21246095
Okay, I understand what you are taking about and I had to restructure my program in order to get it to work.

Private Sub DoIt_Click(ByVal sender As Object, ByVal e As EventArgs) Handles DoIt.Click

        Dim strMessage As String = "True"
        Response.Clear()
        Response.ClearContent()
        Response.ContentType = "Application/doc"
        Response.AddHeader("Content-Disposition", "inline;filename=OpenLargeFile.doc")
        Response.AddHeader("Content-Length", fileData.length.ToString())
        Response.BufferOutput = True
        Response.BinaryWrite(fileData)
        Response.Flush()
        Response.Close()
        Response.End()
        Response.Redirect("report.aspx")
    End Sub

The only problem I have now is that the File is opening in MS Word and opens a seperate window leaving a blank window.  I have tried to add Response.Redirect but it doesn't seem to run that line of code.

Any suggestions?  Thanks for your help.
 
 
04.01.2008 at 01:21PM PDT, ID: 21257748
Sorry... you won't be able to close the window... as soon as you change the HHTP headers, the actual HTML file then becomes/is being considered as a file instead... and therefore, response.redirect doesn't amount to anything in a Word file... sucks but... there's nothing you can do... or at least i'm not aware of anything that you can do to close the window.
 
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628