Please! Doesn't anyone know a better way to do this?

C

Coleen

Hi All :)

I am desperately looking for some help/information on how to direct page
flow. Forget what I have done - here's what I need to do:

I have a large ASPX.Net - VB.Net web application (around 35-40 pages) that
once the user logs in, I need to direct them to the correct page, depending
on what they select from the directory. In other words...when they login,
if they are a new user, a new account screen comes up and from there a
series of screens need to be entered in a specific order. Then, depending
on what they select after they have completed the new account info, the flow
needs to direct them from the entry screens to invoices, payments,
electronic signature and receipts pages.

I know this can be done, we do it all the time when doing things such as
ordering books, or any type of on-line shopping. I currently am using
Session State (variables) and pass them from the directory page to the page
called. The problem with this is that we also have a JavaScript Drop-down
menu and the variables don't get set if they select a page from the drop
down. How do I overcome this limitation? Isn't there a better way to do
this?

Please Help! Any info would be GREATLY appreciated!

TIA,

Coleen
 
D

Dblood

Coleen,

I'm having trouble understanding exactly what you want to do, but from
what I gather, you need to know when a new user comes in and handle
them differently than an existing user. Let's break down your request,
with some additional questions inline.
...when they login,
if they are a new user, a new account screen comes up

I assume here that you're checking a database when the user attempts to
login and if the user isn't found you want to redirect to the "new user
signup" -or- the user clicks a "register" button to get to the signup
page. Correct?
from there a
series of screens need to be entered in a specific order.

You have a "wizard type" progression that you want to perform here?

Then, depending
on what they select after they have completed the new account info, the flow
needs to direct them from the entry screens to invoices, payments,
electronic signature and receipts pages.

You want the choices they've made to dictate where they are sent
afterwards, and these options are saved in the database with each user
account?
I currently am using
Session State (variables) and pass them from the directory page to the page
called. The problem with this is that we also have a JavaScript Drop-down
menu and the variables don't get set if they select a page from the drop
down. How do I overcome this limitation? Isn't there a better way to do
this?

This kinda sounds like you're not storing the user's options in the
database, please correct me if I'm wrong.

-------------------------------------------------------------

Here's how I'd attack this if it were my problem. There are many ways
to do it, but this is my OPINION (as I don my flame retardant gear).

When a new user attempts to login or clicks to register, I'd redirect
them to my new user signup. I'd use server-side HTML tables to house
each "page" of the signup process (all on one aspx page), and control
the user's progress with a hidden textbox's value. I'd use next and
back buttons to increment the hidden textbox's value. I'd use a Select
Case on that value in the code-behind to determine which table needed
to be visible (only 1 table "Page" visible at a time).

For instance:
(HTML)
<Table id=tblSignUp1 runat=server>
[Sign up Procedure - Page 1 (Your HTML for Page 1)]
</Table>
<Table id=tblSignUp2 runat=server visible=False>
[Sign up Procedure - Page 2 (Your HTML for Page 2)]
</Table>
<Table id=tblSignUp3 runat=server visible=False>
[Sign up Procedure - Page 3 (Your HTML for Page 3)]
</Table>
<asp:button id=btnNext text="Next" runat=server></asp:button>
<asp:button id=btnBack text="Back" runat=server></asp:button>
<input type=hidden name="txtStep">

(code-behind in PageLoad of Signup.aspx)
Dim myStepNum as Int16
myStepNum = Cint(Request.Parameters("txtStep"))

Select Case myStepNum
Case 1 'Display page 1
tblSignUp1.Visible = True
tblSignUp2.Visible = False
tblSignUp3.Visible = False
Case 2 'Display page 2
tblSignUp1.Visible = False
tblSignUp2.Visible = True
tblSignUp3.Visible = False
Case 3 'Display page 3
tblSignUp1.Visible = False
tblSignUp2.Visible = False
tblSignUp3.Visible = True
End Select

When the user clicks "DONE", I'd insert a new record into the DB and
(in a separate table) add all the user's options. I'd then redirect
the user back to the login page. The login procedure should add the
user's ID to Context.Session.Item("user_id") - [from the DB during
login if the user is validated]

Then, I would create a class called usersettings. On each page load,
I'd instantiate the usersettings class and load all the user's info
into my class variable through a query to the database based upon my
Context.Session.Item("user_id") value. I'd create a method to handle
this population.

Something like this:
[Class]
Public Class usersettings
Public Structure oUser
Public UID as int16
Public setting1 as string
Public setting2 as string
End Structure

Public Function GetSettings(ByVal user_id as Int16) as oUser
Dim currentUser as oUser
[connect to database and retrieve settings]
currentUser.UID = user_id
currentUser.setting1 = myDataView(0).Row("Setting1")
...
Return currentUser
End Function
End Class

[Page Load]
Dim tmp as New usersettings
Dim myUser as oUser
myUser = tmp.GetUserInfo(Context.Session.Item("user_id"))
tmp = Nothing

This way, I have all the user info at my disposal before anything else
on the page happens. You could probably do this in Global.asax in the
BeginRequest event too. I'll leave that for later.

Not sure how the java menu's will affect this approach because I don't
use them.

Maybe this is a start for you, maybe I'm completely off base as far as
the questions you asked, and maybe someone will tell me that this is a
horrible approach, but I've used this successfully in the past. The
code included wasn't compiled and is really just a Psuedo-code example.

Let me know if it helps. Good luck

dkb
 
C

Coleen

Well you've got it partially right. We will be storing the user's name &
password (right now the application is set up as a "Demo") What I'm trying
to do is direct the user from page to page - i.e., after the user sets up an
account, they need to automatically be directed to the page to enter data
for the fleet (this is a Fleet vehicle registration application) and after
they enter the fleet info they need to be directed to the vehicle
registration section. This is actually quite easy the way that I'm doing it
with Session Variables (in the directory if they chose Add Account I set a
session variable on the Account page (Session("page_name"). This session
variable gets changed as they flow from window to window using the Next
button. If they use the JavaScript drop-down menu instead, the session
variable doesn't get set and the next page doesn't "know" where it was
called from...does that make more sense? I'm using .Net 1.1 right now but
we are (supposed) to be upgrading to .Net 2005 (ASPX 2.0). I just can't
think of a better way to "tell" my pages which page the call originated
from...is there another way that the JavaScript menus won't interfere with?
Thanks very much for any/all help :)


Dblood said:
Coleen,

I'm having trouble understanding exactly what you want to do, but from
what I gather, you need to know when a new user comes in and handle
them differently than an existing user. Let's break down your request,
with some additional questions inline.
...when they login,
if they are a new user, a new account screen comes up

I assume here that you're checking a database when the user attempts to
login and if the user isn't found you want to redirect to the "new user
signup" -or- the user clicks a "register" button to get to the signup
page. Correct?
from there a
series of screens need to be entered in a specific order.

You have a "wizard type" progression that you want to perform here?

Then, depending
on what they select after they have completed the new account info, the flow
needs to direct them from the entry screens to invoices, payments,
electronic signature and receipts pages.

You want the choices they've made to dictate where they are sent
afterwards, and these options are saved in the database with each user
account?
I currently am using
Session State (variables) and pass them from the directory page to the page
called. The problem with this is that we also have a JavaScript Drop-down
menu and the variables don't get set if they select a page from the drop
down. How do I overcome this limitation? Isn't there a better way to do
this?

This kinda sounds like you're not storing the user's options in the
database, please correct me if I'm wrong.

-------------------------------------------------------------

Here's how I'd attack this if it were my problem. There are many ways
to do it, but this is my OPINION (as I don my flame retardant gear).

When a new user attempts to login or clicks to register, I'd redirect
them to my new user signup. I'd use server-side HTML tables to house
each "page" of the signup process (all on one aspx page), and control
the user's progress with a hidden textbox's value. I'd use next and
back buttons to increment the hidden textbox's value. I'd use a Select
Case on that value in the code-behind to determine which table needed
to be visible (only 1 table "Page" visible at a time).

For instance:
(HTML)
<Table id=tblSignUp1 runat=server>
[Sign up Procedure - Page 1 (Your HTML for Page 1)]
</Table>
<Table id=tblSignUp2 runat=server visible=False>
[Sign up Procedure - Page 2 (Your HTML for Page 2)]
</Table>
<Table id=tblSignUp3 runat=server visible=False>
[Sign up Procedure - Page 3 (Your HTML for Page 3)]
</Table>
<asp:button id=btnNext text="Next" runat=server></asp:button>
<asp:button id=btnBack text="Back" runat=server></asp:button>
<input type=hidden name="txtStep">

(code-behind in PageLoad of Signup.aspx)
Dim myStepNum as Int16
myStepNum = Cint(Request.Parameters("txtStep"))

Select Case myStepNum
Case 1 'Display page 1
tblSignUp1.Visible = True
tblSignUp2.Visible = False
tblSignUp3.Visible = False
Case 2 'Display page 2
tblSignUp1.Visible = False
tblSignUp2.Visible = True
tblSignUp3.Visible = False
Case 3 'Display page 3
tblSignUp1.Visible = False
tblSignUp2.Visible = False
tblSignUp3.Visible = True
End Select

When the user clicks "DONE", I'd insert a new record into the DB and
(in a separate table) add all the user's options. I'd then redirect
the user back to the login page. The login procedure should add the
user's ID to Context.Session.Item("user_id") - [from the DB during
login if the user is validated]

Then, I would create a class called usersettings. On each page load,
I'd instantiate the usersettings class and load all the user's info
into my class variable through a query to the database based upon my
Context.Session.Item("user_id") value. I'd create a method to handle
this population.

Something like this:
[Class]
Public Class usersettings
Public Structure oUser
Public UID as int16
Public setting1 as string
Public setting2 as string
End Structure

Public Function GetSettings(ByVal user_id as Int16) as oUser
Dim currentUser as oUser
[connect to database and retrieve settings]
currentUser.UID = user_id
currentUser.setting1 = myDataView(0).Row("Setting1")
...
Return currentUser
End Function
End Class

[Page Load]
Dim tmp as New usersettings
Dim myUser as oUser
myUser = tmp.GetUserInfo(Context.Session.Item("user_id"))
tmp = Nothing

This way, I have all the user info at my disposal before anything else
on the page happens. You could probably do this in Global.asax in the
BeginRequest event too. I'll leave that for later.

Not sure how the java menu's will affect this approach because I don't
use them.

Maybe this is a start for you, maybe I'm completely off base as far as
the questions you asked, and maybe someone will tell me that this is a
horrible approach, but I've used this successfully in the past. The
code included wasn't compiled and is really just a Psuedo-code example.

Let me know if it helps. Good luck

dkb
 
D

Dblood

Colleen,

Here something to try, create a String variable (I'll call it
strRefUrl) then in Page Load, assign it: strRefUrl =
Request.UrlReferrer, the result SHOULD be the url of the page you just
left. You'll have to parse the page name out by doing some string
manipulation, but it should be easy enough with the InStrRev() function
looking for the first "/" character (because we're going right to left)
and then using the Mid() function to pull out the page name. Assign
that to your Session variable and then proceed as normal. Again, I
don't know if the Java buttons are going to affect this, but it's worth
a try.

If the string stuff holds you up, post the page url and I'll write the
code to parse the string.

dkb
 
C

Coleen

DKB - Thank you so much for the suggestion. Let me try the string stuff
myself - I'm going to play with it for a few days - I'm stuck waiting for
the upgrade to .Net 2005 before I can do a whole lot on this right now, but
at least this gets me started! Thanks, I really appreciate the help!
Sometimes you just need another view on how to do things...

Coleen
 
D

Dblood

Coleen,

Oops. It should be Request.URL.Referrer.ToString.

You;d have figured that out, I'm sure, but I feel better now that I
didn't give you bum info.

dkb
 
C

clintonG

You're wasting your time using 1.1 because everything you need to do is
built into 2.0; the Wizard control and Membership, Roles and Profiles all of
which make it possible for the business rules your working with rather easy
to build.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W
 
C

Coleen

Thank you! I get my new "Test" machine today, so I should now be able to
test this in ASP.Net 2 :-D
 
C

Coleen

I know! I've been nagging at our Management for months to complete the
upgrade - I finally got news this morning that I will get the "Test" machine
today and I can start testing the move of our application and can really
start to accomplish something now! Yay!!!

Thanks :)

Coleen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top