?
Solved

Mulitple Page_Load() ???

Posted on 2008-06-11
5
Medium Priority
?
297 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Suggested Courses

765 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