473,789 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

response.redire ct (this page?)...short and sweet way to do this?

I have a 'cancel' button that should reload the current page. Ie, reset the
page back to it's initial state.

Is the best way to do this to simply have the event handler for that button
redirect the page to itself?

If so, is there a short-and-sweet way to write that out? Or do I need to
first grab the URL and parse it?

I don't want to hardcore the url as this might be used in different
locations.

-Darrel
Nov 18 '05 #1
5 19539
You should be able to use Response.Redire ct(".") or
Response.Redire ct(Request.URL)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"darrel" <no*****@hotmai l.com> wrote in message
news:uE******** ******@TK2MSFTN GP10.phx.gbl...
I have a 'cancel' button that should reload the current page. Ie, reset the page back to it's initial state.

Is the best way to do this to simply have the event handler for that button redirect the page to itself?

If so, is there a short-and-sweet way to write that out? Or do I need to
first grab the URL and parse it?

I don't want to hardcore the url as this might be used in different
locations.

-Darrel

Nov 18 '05 #2
> Response.Redire ct(Request.URL)

Oh. Duh. Missed the obvious on that one! ;o)

Thanks!

-Darrel
Nov 18 '05 #3
Why not just use an HTML Cancel button and save the round trip?

Dale

"darrel" <no*****@hotmai l.com> wrote in message
news:eY******** *****@TK2MSFTNG P09.phx.gbl...
Response.Redire ct(Request.URL)


Oh. Duh. Missed the obvious on that one! ;o)

Thanks!

-Darrel

Nov 18 '05 #4

"Dale" <da************ @msndotcomNot.N et> wrote in message news:uX******** *****@TK2MSFTNG P10.phx.gbl...
Why not just use an HTML Cancel button and save the round trip?

Dale


That might not work correctly: if postbacks have happened
(server side validators, autopostback, ...) then the values
of that latest postback will be restored, not the real initial values!

Hans Kesting
Nov 18 '05 #5
darrel wrote:
I have a 'cancel' button that should reload the current page. Ie, reset the
page back to it's initial state.

Is the best way to do this to simply have the event handler for that button
redirect the page to itself?

If so, is there a short-and-sweet way to write that out? Or do I need to
first grab the URL and parse it?

I don't want to hardcore the url as this might be used in different
locations.

-Darrel

Hello,

Hope this helps (see attached text file)

ChiefDnd

Private Sub btnCancel_Reset _Click(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnCancel_Reset .Click
'/////////////////////////////////////////////////////////////////
' Clear the form (Textbox and DropDownList)
'/////////////////////////////////////////////////////////////////
Dim objC As Control
For Each objC In Page.Controls
Dim objType As Type = objC.GetType()
If objType.FullNam e = "System.Web.UI. HtmlControls.Ht mlForm" Then
Dim objF As HtmlForm = CType(objC, HtmlForm)
Dim objWC As Control
For Each objWC In objF.Controls
Dim objWCType As Type = objWC.GetType()
If objWCType.FullN ame = "System.Web.UI. WebControls.Tex tBox" Then
Dim objTB As TextBox = CType(objWC, TextBox)
objTB.Text = ""
End If
If objWCType.FullN ame = "System.Web.UI. WebControls.Dro pDownList" Then
Dim objDDL As DropDownList = CType(objWC, DropDownList)
objDDL.Selected Index = 0
End If
Next objWC
End If
Next objC
lblMessage.Visi ble = False
'/////////////////////////////////////////////////////////////////
' Refill the form as needed
'/////////////////////////////////////////////////////////////////
SetupPage()
End Sub
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3909
by: Paul | last post by:
I'm not getting the results I want when I use Response.Redirct in a ASP page. I enter this line of code in a asp page from domain1.com. Response.Redirect "http://www.domain2.com/VDIR2/table.asp" & "?PubID=" & PubID & "&PubName=" & PubName The query string is data to open a DB. the page displays
2
2131
by: Tim | last post by:
response.redirect seems to urlencode a querystring thrown across at it.. is there a way to disable this function that anyone knows of? ie.. response.redirect "http://www.blurb.com/default.asp?test=sweet+%26+sour" actually comes back after the redirect with the % urlencoded which obviously considering its been given the encoding anyway is a nightmare.. ie "http://www.blurb.com/default.asp?test=sweet+%2526+sour"
3
9083
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The problem i faced while using Response.Redirect is that the page that is directed to, does not looks as desired..the textboxes are not visible anymore and so as
6
4326
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx serves two purposes, 1. it contains a tab strip with response.redirects to navigate to the other pages; 2. I authenticate the user by check to see if a cookie exists, if it doesn't I redirect to a login screen.
13
4704
by: Tim | last post by:
Hello, Is there a way to "cancel" a response.Redirect? For example, in the code below, could I insert anything in the Catch statement that would cancel the redirect and resume flow after the try-catch? Try Response.Redirect(strPage) Catch ex1 As Threading.ThreadAbortException ex1 = ex1 'Cancel Respone here
15
6399
by: KBuser | last post by:
I recently developed an internal website with various queries against our SQL server. I added buttons with Response.Redirect. These buttons do not work with Internet Explorer, however when using Firefox the page works flawless. Does anyone know why this is happening or how to fix it?
5
4573
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks a session variable, and if it is not present, does a Response.Redirect to a webpage for the CAS passing a url parameter for the url to post back to. The CAS provides a page for the user to log into, validates the username and password, and then...
0
1326
by: im20 | last post by:
I am helping a polish up a client's PPC campaign and when of the problems I have run into is that the real estate backend system he is using, does not allow the ability to link directly to a predefined search. Say for a city. You have to use a form to get anything out of the system in return. You can link directly to a listing but not a search. Here is an example of one website that actually used a sliced up image map that does the search. ...
9
4347
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of Server.Execute (or Server.Transfer), when the server
0
9506
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6761
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.