473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

response.redirect (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 19507
You should be able to use Response.Redirect(".") or
Response.Redirect(Request.URL)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"darrel" <no*****@hotmail.com> wrote in message
news:uE**************@TK2MSFTNGP10.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.Redirect(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*****@hotmail.com> wrote in message
news:eY*************@TK2MSFTNGP09.phx.gbl...
Response.Redirect(Request.URL)


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

Thanks!

-Darrel

Nov 18 '05 #4

"Dale" <da************@msndotcomNot.Net> wrote in message news:uX*************@TK2MSFTNGP10.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.EventArgs) 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.FullName = "System.Web.UI.HtmlControls.HtmlForm" 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.FullName = "System.Web.UI.WebControls.TextBox" Then
Dim objTB As TextBox = CType(objWC, TextBox)
objTB.Text = ""
End If
If objWCType.FullName = "System.Web.UI.WebControls.DropDownList" Then
Dim objDDL As DropDownList = CType(objWC, DropDownList)
objDDL.SelectedIndex = 0
End If
Next objWC
End If
Next objC
lblMessage.Visible = 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
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...
2
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...
3
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...
6
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...
13
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...
15
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...
5
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...
0
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...
9
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)....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.