Solved

Mulitple Page_Load() ???

Posted on 2008-06-11
5
287 Views
Last Modified: 2010-04-06
Hello,

I have a dreamweaver template created in C# with a void Page_Load() procedure. I have another page that this template is applied to, but which also has a Page_Load() to do its own thing. I can't have two page_loads so how would you recommend I work around this?

They both need to check a value in a database before displaying the page, which is why they both have page_load events/procedures.
0
Comment
Question by:sal-ee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Tristan Shortland
ID: 21759979
Do:

void Page_Load() {
     doThing1;
     doThing2;
}

void doThing1(){
    'do stuff
}

void doThing1(){
    'do stuff
}

0
 
LVL 2

Author Comment

by:sal-ee
ID: 21760198
So close!! Thing is, my template needs the page_load() in order to format the template for the right users (i.e. for Managers, they see a different template).

The other page needs to select a record from the database on page load too, in order to determine whether to display a form or not.

The template is applied to many other pages which will not contain "doThing2"... Am I making sense?
0
 
LVL 4

Expert Comment

by:Tristan Shortland
ID: 21760457
Could you say :

try{
     doThing2;
} catch {
    'doesn't matter
}

So that it only calls do thing 2 if it exists, and just ignores it on other pages?
0
 
LVL 2

Author Comment

by:sal-ee
ID: 21766990
Well, I don't know much about try and catch and I was looking around on the Internet. I tried just as you said above so I put (checkDisc() being my "doThing2")

try{
    checkDisc();
}catch{
    //do nothing
}

- literally! I don't know what I have to put in the //do nothing part? Could you help me with what to write, like literally the code? Sorry for being difficult!
0
 
LVL 2

Accepted Solution

by:
sal-ee earned 0 total points
ID: 21884153
I looked into the try and catch statement but it didn't work when everything and everybody said it should do! So I gave up. I've had to do a dirty fix to get past this as the intranet I am building needed to go live. So I created a second template for that one page to have a different page_load from the others. So basically, I have one page with it's own template. Not good but it works for now!

So somebody, please help as I can't leave it like this!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question