Avatar of rwallacej
rwallacej

asked on 

ASP.net and referring to previous page when clicking on a link

Hi

Some help needed please.

Scenario:
Master page with left panel; left panel has a usercontrol that is menu with links to pages, say they're called Page1.aspx, Page2.aspx, Page3.aspx.  They use all use the MasterPage

First page displayed in Page1.aspx. Page1.aspx has a user control of type "MyUsercontrol"
Page2.aspx has a user control of type "AnotherUsercontrol"
Page3.aspx has a user control of type "YetAnotherUsercontrol"

User clicks on "Page2.aspx" or "Page3.aspx" link; I want to then call a method on the Page1.aspx MyUserControl code-behind (method is NON-Shared)
Same type of thing .....
If user is currently on Page2.aspx and they click on Page1.aspx or Page3.aspx, I want to then call a method on the Page2.aspx AnotherUsercontrol code-behind (method is NON-Shared)
If user is currently on Page3.aspx and they click on Page1.aspx or Page2.aspx, I want to then call a method on the Page3.aspx YetAnotherUsercontrol code-behind (method is NON-Shared)

So to summarise when user clicks on a link, I was to call a non-shared method on a user control of the PREVIOUS page. I know I could have a Javascript onunload method for pages but I don't want to have to rewrite the code-behind in Javascript.

I've  also seen Javascript call a WebMethod() on code behind but found that the method had to be shared (and as shared it couldn't access e.g. textboxes on user control)

How do I go about this?  

Thanks
.NET ProgrammingAJAXASP.NET

Avatar of undefined
Last Comment
rwallacej
Avatar of Reecio
Reecio

If you have public procedures in the master page you can call them from the sub pages, or are you after a specific controls event procedure?
I write my asp in VB, so for me the syntax would be something like ctype(Page.Master,MasterPage).
Hope that helps!?
Avatar of rwallacej
rwallacej

ASKER

Hi
The methods I'm trying to access on leaving from one page and going to another are those in Page1.aspx.vb, Page2.aspx.vb, Page3.aspx.vb
So when going away from Page1.aspx to Page2.aspx or Page3.aspx I want to call a method in Page1.aspx.vb

The methods aren't in the master page.

The are used to put save stuff into session of what user has entered on Page1.aspx when moving to another page like Page2.aspx or Page3.aspx, or what user has entered onto Page2.aspx when moving to Page1.aspx or Page3.aspx.

Hope this makes sense?

Thanks
Avatar of rwallacej
rwallacej

ASKER

the "easy" thing would be to put a button on each page Page1.aspx, Page2.aspx and Page3.aspx that calls their own .aspx.vb methods .....however I'll find users go from one page to another using links at left without clicking "Save" and then loose their changes
ASKER CERTIFIED SOLUTION
Avatar of Reecio
Reecio

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of rwallacej
rwallacej

ASKER

thanks
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo