Forums: [SOLVED] Which page am I on? - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

[SOLVED] Which page am I on? Rate Topic: -----

#1 User is offline   timnorvel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 290
  • Joined: 21-September 07
  • Gender:Male
  • Location:Minnesota, USA

Posted 05 April 2019 - 12:55 PM

Hi all,

In version 10.1 I have created 2 edit pages and now I want to run different event code depending on which page loads. The event I'm using is Before record updated. So something like:


if (GET_PAGE_NAME == "edit1")
{
Do stuff
}
else
{
Do other stuff
}



How do I get the page name? Or maybe there's a different way to run different code for different edit pages of the same table?

Thanks,
Tim
0

#2 User is offline   ChrisN 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 50
  • Joined: 01-November 14

Posted 08 April 2019 - 07:43 AM

Hi Tim,

I'm not sure if this blog item will help ... Additional Pages

Cheers,

Chris
0

#3 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16451
  • Joined: 03-February 03
  • Gender:Male

Posted 08 April 2019 - 10:48 PM

Read "page" parameter from the URL as HttpContext.Current.Request.QueryString["page"].ToString()

i.e.

if (HttpContext.Current.Request.QueryString["page"].ToString() == "edit1") 
{
Do stuff
}
else
{
Do other stuff
}

Best regards,
Sergey Kornilov
0

#4 User is offline   timnorvel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 290
  • Joined: 21-September 07
  • Gender:Male
  • Location:Minnesota, USA

Posted 09 April 2019 - 01:18 PM

Thank you both! Chris, based on your link (not sure how I missed that blog post) I was able to see that this is just a post value, so I came up with:

if (MVCFunctions.postvalue("page")=="edit1")
{
Do stuff
}
else
{
Do other stuff
}

Which seems to work fine.

Admin, your solution seems to be the same approach but uses standard ASP.Net code instead of the ASPRunner function...? Maybe this is a better way to go.

Either way, now that I'm getting familiar with adding multiple pages in version 10, this seems like a trick I'm going to want to use often.

Thanks again.
Tim
0

#5 User is offline   Corrie De Wet 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 28-July 17

Posted 20 April 2019 - 05:30 PM

You might be able to use $_GET["page"]

IF(IsSet($_GET["page"]))
{
if ($_GET["page"] == "edit1")
{
Do stuff
}
else
{
Do other stuff
}
}

Also check out my channel: https://www.youtube....dkdHhdjTuto6urg



View Posttimnorvel, on 05 April 2019 - 02:55 PM, said:

Hi all,

In version 10.1 I have created 2 edit pages and now I want to run different event code depending on which page loads. The event I'm using is Before record updated. So something like:


if (GET_PAGE_NAME == "edit1")
{
Do stuff
}
else
{
Do other stuff
}



How do I get the page name? Or maybe there's a different way to run different code for different edit pages of the same table?

Thanks,
Tim

0

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users