sal-ee
asked on
Mulitple Page_Load() ???
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.
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.
ASKER
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?
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?
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?
try{
doThing2;
} catch {
'doesn't matter
}
So that it only calls do thing 2 if it exists, and just ignores it on other pages?
ASKER
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!
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!
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
void Page_Load() {
doThing1;
doThing2;
}
void doThing1(){
'do stuff
}
void doThing1(){
'do stuff
}