response.redirect question...

  • Thread starter Thread starter Johnb41
  • Start date Start date
J

Johnb41

My web page has a bunch of text boxes, check boxes, radio
buttons, etc.

The checkboxes have an OnCheckedChanged event.
The textboxes have an OnTextChanged event.

etc...

When my page is submitted, it reloads the page, and then
processes the code for the events (assuming a checkbox
has been changed or text has been changed).

Problem:
I need the page to do a response.redirect("page2.aspx")
after all the form items have been processed.

Is there any way to do the redirect after all those
events have been processed? Normally i would put all the
code in a routine that checks the value of all my form
fields, and then do the redirect. But I want to do it
differently by firing events when form fields have
changed.

Any ideas?

Thanks,
John
 
You could do this if I understand what you want:
Let's assume you have 2 textboxes and 2 checkboxes

Sub text1_OnTextChanged
Count =+ 1
ViewState("Count") = Count
end sub

Sub text2_OnTextChanged
Count =+ 2
ViewState("Count") = Count
end sub

Sub check1_OnCheckedChanged
Count =+3
ViewState("Count") = Count
end sub

Sub check2_OnCheckedChanged
Count =+4
ViewState("Count") = Count
end sub

And in the page load check the value of Count


Sub Page_Load

If Count => 4 then
Response.Redirect("page.aspx")
end if

End Sub

Something like that.
 
Thanks for the help... but i'd rather not have a sub
routine for every single form field. I'm trying to keep
it simple by having 1 routine for all checkboxes, another
routine for all textboxes, etc. Each checkbox would have
the same event name: OnCheckChanged="abc"

Sub abc
...
End sub

Thanks,
John
 
Private Sub Page_Unload(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Unload
Response.Redirect("Page2.aspx")
End Sub

Unload event is the last shoot of page class
 
Back
Top