Recognize Click and Content Page from Masterpage

Hi EE,

I have a masterpage that has common stuff I will use for a wizard.  It has a horizontal list that I use as menu that when clicked takes you to different content pages (all using the same masterpage).
I also have 4 buttons on the masterpage that move next/back.
I need to write a procedure that will handle the next and back.  There are about 20 content pages.
How do I tell what page the user is on?  Right now I am sending data from one form  to another using the previouspage directive.

Please provide some sample code,

Thanks
SheritlwAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SriVaddadiCommented:
0
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

TeazerMDCommented:
ok, here we go:
1. I would recommend using ViewState to store your current position;
2. Name your pages properly.

Here is an example of how the functions could look like:

protected void nextButton_Click(object sender, EventArgs e)
    {
        int step_number = 0;
        if (ViewState["wizzard_step"] != null)
        {
            step_number = (int)ViewState["wizzard_step"];
            if (step_number < max_steps)
            {
                step_number++;
                ViewState["wizzard_step"] = step_number;
            }
        }
        else
        {
            step_number = 1;
            ViewState.Add("wizzard_step",step_number);
        }

        Server.Transfer("~/Step" + step_number + ".aspx");

    }

    protected void backButton_Click(object sender, EventArgs e)
    {
        int step_number = 0;
        if (ViewState["wizzard_step"] != null)
        {
            step_number = (int)ViewState["wizzard_step"];
            if (step_number > 1)
            {
                step_number--;
                ViewState["wizzard_step"] = step_number;
            }
        }
        else
        {
            step_number = 1;
            ViewState.Add("wizzard_step", step_number);
        }

        Server.Transfer("~/Step" + step_number + ".aspx");
    }

Open in new window

0
SheritlwAuthor Commented:
Hi,

So I have to manage the clicks from each separate page?
I thought I could create a function in the masterpage that would list and track all my pages.  
I am lost on this one.



0
SriVaddadiCommented:
Did you look at the sitemap links i forwarded?
0
EspavoCommented:
Here's how I do it:
Dim ThisCallingName As String
ThisCallingName = System.IO.Path.GetFileName(Request.FilePath)

If ThisCallingName = "Survey.aspx" Then
End if
Espavo
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SheritlwAuthor Commented:
Does the "ThisCallingName" determine which page is active?
0
TeazerMDCommented:
Sheritlw
   The sample code I provided handles the clicks on a masterpage level and dosen't require you to handle clicks on each page separatly.

Teazer.
0
SheritlwAuthor Commented:
I will convert your code to vb.net 2008 and try it.
Thanks
0
EspavoCommented:
Sheritlw> Does the "ThisCallingName" determine which page is active?
Yes.
Espavo
0
EspavoCommented:
Something I forgot...
The code I dropped here should be in the Page_Load sub of your MasterPage...
Espavo
0
SheritlwAuthor Commented:
Hi Espavo,

That works great and it's easy.

Thanks
0
SheritlwAuthor Commented:
Quick and simple solution.
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.