Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET and Page Navigation

Reply
Thread Tools

ASP.NET and Page Navigation

 
 
Raj
Guest
Posts: n/a
 
      10-23-2006
Hi,

I am struggling with this for quite some time and thought will seek
your help on it. What I am doing is, I have Page1.aspx where user
inputs text into text boxes and also has a link to Page2.aspx. On
Page2.aspx user will input some more info and has two buttons 'Save'
and 'Cancel'. Both the buttons on Page2.aspx should take the user back
to Page1.aspx and the data entered by the user on Page1 should not be
lost. So, Response.Redirect is not an option since you lose data.
I tried PostBackURL and 'javascript:history.go(-1)' and that works but
here is my problem.

If user enters invalid data on Page2, clicking on 'Save' button should
not take the user back to Page1. But if I use PostBackURL it is doing
that way and I don't know how to control the event. In otherwords I
want the event to run only when valid data is entered. I can do
validation in btnSave_Click but don't know how to control the flow.

I will truly appreciate your input on the issue. Thank you,

Raj

 
Reply With Quote
 
 
 
 
Jester98x
Guest
Posts: n/a
 
      10-23-2006

Raj wrote:
> Hi,
>
> I am struggling with this for quite some time and thought will seek
> your help on it. What I am doing is, I have Page1.aspx where user
> inputs text into text boxes and also has a link to Page2.aspx. On
> Page2.aspx user will input some more info and has two buttons 'Save'
> and 'Cancel'. Both the buttons on Page2.aspx should take the user back
> to Page1.aspx and the data entered by the user on Page1 should not be
> lost. So, Response.Redirect is not an option since you lose data.
> I tried PostBackURL and 'javascript:history.go(-1)' and that works but
> here is my problem.
>
> If user enters invalid data on Page2, clicking on 'Save' button should
> not take the user back to Page1. But if I use PostBackURL it is doing
> that way and I don't know how to control the event. In otherwords I
> want the event to run only when valid data is entered. I can do
> validation in btnSave_Click but don't know how to control the flow.
>
> I will truly appreciate your input on the issue. Thank you,
>
> Raj


Hi Raj,

It sounds like a wizard control may help you out here. Also use the
data validation controls to assist with data checks. You can use
page.isvalid to check if the page is valid and then continue processing
in which ever direction you want.

Stece

 
Reply With Quote
 
 
 
 
BillE
Guest
Posts: n/a
 
      10-23-2006
Is it necessary to have two pages?
Instead, maybe you could put two panels on the same page, and hide and
display them on postback when the buttons are clicked.

-Bill

"Jester98x" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>
> Raj wrote:
>> Hi,
>>
>> I am struggling with this for quite some time and thought will seek
>> your help on it. What I am doing is, I have Page1.aspx where user
>> inputs text into text boxes and also has a link to Page2.aspx. On
>> Page2.aspx user will input some more info and has two buttons 'Save'
>> and 'Cancel'. Both the buttons on Page2.aspx should take the user back
>> to Page1.aspx and the data entered by the user on Page1 should not be
>> lost. So, Response.Redirect is not an option since you lose data.
>> I tried PostBackURL and 'javascript:history.go(-1)' and that works but
>> here is my problem.
>>
>> If user enters invalid data on Page2, clicking on 'Save' button should
>> not take the user back to Page1. But if I use PostBackURL it is doing
>> that way and I don't know how to control the event. In otherwords I
>> want the event to run only when valid data is entered. I can do
>> validation in btnSave_Click but don't know how to control the flow.
>>
>> I will truly appreciate your input on the issue. Thank you,
>>
>> Raj

>
> Hi Raj,
>
> It sounds like a wizard control may help you out here. Also use the
> data validation controls to assist with data checks. You can use
> page.isvalid to check if the page is valid and then continue processing
> in which ever direction you want.
>
> Stece
>



 
Reply With Quote
 
Jesse Liberty
Guest
Posts: n/a
 
      10-23-2006
Setting aside the fact that I think you've created a bit of extra complexity
for yourself with the two pages, I think you need to sort out the various
issues:

1. Javascript (let's set that aside for now and stick with traditional
server-side processing)
2. Validation
3. State management

You are right that if you move from page 1 - 2 and then back to 1 page 1's
controls will no longer have view state, but of course you can stash their
values in session state and restore their values manually, which is not
onerous.

Second, you can use the standard validation controls on page 2 and not leave
page 2 until and unless the controls are all valid

What is really sounds like, however, is that you want the second page to be
a "modal dialog" for page 1, in which case you don't really need to shut
page 1 (and thus, it can maintain its state), you just need to have page 2,
on save, validate itself, and if valid, populate session state.

Ah, but here's the problem, there is no easy way for page 2 to notify page 1
that it is now done and there is something nifty for page 1 in session
state.

You have a few choices. The ugly but perhaps easiest way is for page 1 to
look in session state every couple seconds to find a signal: "good data
available" or "page 2 failed". If it finds the former, it gobbles up the
data it needs and populates its additional fields. I'll look into other
ways for one page to signal another, but ASP.NET isn't (as far as I know)
really set up for that.

Enjoy.

-j

--
Jesse Liberty
Microsoft MVP
Author/ Programmer
http://www.LibertyAssociates.com




"Raj" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hi,
>
> I am struggling with this for quite some time and thought will seek
> your help on it. What I am doing is, I have Page1.aspx where user
> inputs text into text boxes and also has a link to Page2.aspx. On
> Page2.aspx user will input some more info and has two buttons 'Save'
> and 'Cancel'. Both the buttons on Page2.aspx should take the user back
> to Page1.aspx and the data entered by the user on Page1 should not be
> lost. So, Response.Redirect is not an option since you lose data.
> I tried PostBackURL and 'javascript:history.go(-1)' and that works but
> here is my problem.
>
> If user enters invalid data on Page2, clicking on 'Save' button should
> not take the user back to Page1. But if I use PostBackURL it is doing
> that way and I don't know how to control the event. In otherwords I
> want the event to run only when valid data is entered. I can do
> validation in btnSave_Click but don't know how to control the flow.
>
> I will truly appreciate your input on the issue. Thank you,
>
> Raj
>




 
Reply With Quote
 
Raj
Guest
Posts: n/a
 
      10-23-2006
Thank you very much guys for your prompt response. I can not use
standard validation controls on Page2 which means I have to validate
when user submits 'Submit' on Page2.

I have decided to combine both pages into a single page and place them
in two different panels. I have also looked into wizard control but
will be using that when I am dealing with more than two pages probably.

Thanks guys for your valuable input.

Raj


Jesse Liberty wrote:
> Setting aside the fact that I think you've created a bit of extra complexity
> for yourself with the two pages, I think you need to sort out the various
> issues:
>
> 1. Javascript (let's set that aside for now and stick with traditional
> server-side processing)
> 2. Validation
> 3. State management
>
> You are right that if you move from page 1 - 2 and then back to 1 page 1's
> controls will no longer have view state, but of course you can stash their
> values in session state and restore their values manually, which is not
> onerous.
>
> Second, you can use the standard validation controls on page 2 and not leave
> page 2 until and unless the controls are all valid
>
> What is really sounds like, however, is that you want the second page to be
> a "modal dialog" for page 1, in which case you don't really need to shut
> page 1 (and thus, it can maintain its state), you just need to have page 2,
> on save, validate itself, and if valid, populate session state.
>
> Ah, but here's the problem, there is no easy way for page 2 to notify page 1
> that it is now done and there is something nifty for page 1 in session
> state.
>
> You have a few choices. The ugly but perhaps easiest way is for page 1 to
> look in session state every couple seconds to find a signal: "good data
> available" or "page 2 failed". If it finds the former, it gobbles up the
> data it needs and populates its additional fields. I'll look into other
> ways for one page to signal another, but ASP.NET isn't (as far as I know)
> really set up for that.
>
> Enjoy.
>
> -j
>
> --
> Jesse Liberty
> Microsoft MVP
> Author/ Programmer
> http://www.LibertyAssociates.com
>
>
>
>
> "Raj" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > Hi,
> >
> > I am struggling with this for quite some time and thought will seek
> > your help on it. What I am doing is, I have Page1.aspx where user
> > inputs text into text boxes and also has a link to Page2.aspx. On
> > Page2.aspx user will input some more info and has two buttons 'Save'
> > and 'Cancel'. Both the buttons on Page2.aspx should take the user back
> > to Page1.aspx and the data entered by the user on Page1 should not be
> > lost. So, Response.Redirect is not an option since you lose data.
> > I tried PostBackURL and 'javascript:history.go(-1)' and that works but
> > here is my problem.
> >
> > If user enters invalid data on Page2, clicking on 'Save' button should
> > not take the user back to Page1. But if I use PostBackURL it is doing
> > that way and I don't know how to control the event. In otherwords I
> > want the event to run only when valid data is entered. I can do
> > validation in btnSave_Click but don't know how to control the flow.
> >
> > I will truly appreciate your input on the issue. Thank you,
> >
> > Raj
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML Form/Page and Navigation with multiple buttons mosscliffe Python 9 06-01-2007 11:18 AM
Disable the navigation buttons for IE navigation toolbar Laurahn ASP .Net 3 02-06-2007 04:17 AM
Page Navigation with Server.Transfer and ViewState Dan ASP .Net 0 10-27-2006 11:45 AM
FireFox (OSX): No in-page keyboard navigation? Daniel J. Stern Firefox 1 12-27-2004 12:15 PM
Beta testers needed for Web Page Layout, Controls, and Site Navigation Add-in Robert Weatherford ASP .Net 0 04-12-2004 04:06 PM



Advertisments