Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Mulitple Page_Load() ???

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

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

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

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.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

609 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