BACK Button Functionality on ASP.NET

Mani Pazhana
Mani Pazhana used Ask the Experts™
on
Hello Experts,
Posted 0 minutes ago (permalink)

Hello Experts,
I am using RAD tool bar on my ASP.Net Web page.

I have BACK button on the toolbar,  on click which should take to previous page. the data of previous page should be shown when we go back to the page.

i used
PostBackUrl="javascript:history.go(-1);"

like shown below

<telerik:RadToolBarButton runat="server" CommandName="Back" DisabledImageUrl="~/Images/BackButton.gif"
                        ImageUrl="~/Images/BackButton.gif" Text="Back" PostBackUrl="javascript:history.go(-1);" >
                        </telerik:RadToolBarButton  >

some cases the above statement throws me an script error, if it could not find the prevoius page.
can someone suggest me the best approch?  can we do with a different approch to avoid script error from code behind?
 
thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Can you try


 <telerik:RadToolBarButton runat="server" CommandName="Back" DisabledImageUrl="~/Images/BackButton.gif"
                    ImageUrl="~/Images/BackButton.gif" Text="Back" NavigateUrl="javascript:history.go(-1);">
                </telerik:RadToolBarButton>

Open in new window

Author

Commented:
Thanks.
I tried both Navigate URL and postback URL,
My issue is, if the page post back occurs, it stores the URL to history
when the user hits the back button on the page, it relods the same page from history.
I want to go to previous page , how to do that? any idea?
 
Thanks
Most Valuable Expert 2012
Top Expert 2014

Commented:
Is the toolbar on a master page?
 
If its on client pages then may be you could update the PostBackURL property on page load using the Request.Referrer
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Author

Commented:
will the Request.Referrer just to redirection to previous page or it will store the state of the previous page?
i mean if i have some data in my previous page, i want to display the page with the same data when i do redirection.
 
thanks
 
 
Most Valuable Expert 2012
Top Expert 2014
Commented:
I think it would have only the URL. The page would have the logic to load data when its launched right?

Author

Commented:
thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial