Guest User

Untitled

a guest
Nov 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. string pageName = this.ContentPlaceHolder1.Page.GetType().FullName;
  2.  
  3. //Page_Load
  4. MyMaster m = (MyMaster)this.Master;
  5.  
  6. m.TellMasterWhoIAm(this);
  7.  
  8. //Only show the message if on the dashboard (first page after login)
  9. if (this.ContentPlaceHolder1.Page is Dashboard)
  10. {
  11. //Show modal message box
  12. mmb.Show("Warning Message");
  13. }
  14.  
  15. Page.ToString().Replace("ASP.","").Replace("_",".")
  16.  
  17. if (Page.TemplateControl.AppRelativeVirtualPath == "~/YourPageName.aspx")
  18. {
  19. // your code here
  20. }
  21.  
  22. if (Page.TemplateControl.AppRelativeVirtualPath.Equals("~/YourPageName.aspx", StringComparison.OrdinalIgnoreCase))
  23. {
  24. // your code here
  25. }
  26.  
  27. this.Request.Url.AbsolutePath
  28.  
  29. string pageName = this.Request.Url.Segments.Last();
  30.  
  31. if (pageName.Contains("EmployeeTermination.aspx"))
  32. {
  33.  
  34. }
  35.  
  36. Request.CurrentExecutionFilePath;
  37.  
  38. Request.AppRelativeCurrentExecutionFilePath;
  39.  
  40. string s = Page.ToString().Replace("ASP.directory_name_","").Replace("_aspx",".aspx").Replace("_","-");
  41. if (s == "default.aspx")
  42. { /* do something */ }
  43.  
  44. <%if(this.MainContent.Page.Title != "mypagetitle") { %>
  45. <%}%>
  46.  
  47. // Assuming MyPage1, MyPage2, and MyPage3 are the class names in your aspx.cs files:
  48.  
  49. if (this.Page is MyPage1)
  50. {
  51. // do MyPage1 specific stuff
  52. }
  53. else if (this.Page is MyPage2)
  54. {
  55. // do MyPage2 specific stuff
  56. }
  57. else if (this.Page is MyPage3)
  58. {
  59. // do MyPage3 specific stuff
  60. }
Add Comment
Please, Sign In to add comment