Webcontrol Designer Awareness...

W

Weston Weems

I've got a webcontrol that has some methods that fire off rendering
javascript to the page etc, that shouldnt be fired off if loaded up in a
designer.

I'd like to know if there is some sort of conditional block I can use to
prevent this code from being run...

Something like

MyWebControl(){

if(!IsDesigner){
registerJs();
}

}

Thanks in advance
 
M

Michael Baltic

You can override the GetDesignTimeHTML method. This is where you specify
what is rendered in the designer. As opposed to RenderContents which gets
your application output.

What code are you using to render the script?
--
Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group

Future Business Model
Loan Origination Services
National City Mortgage
 
M

Michael Baltic

If you are in a webcontrol, you can use this code:

public bool IsDesign
{
get
{
if((this.Site != null && this.Site.DesignMode) || (this.Page != null &&
this.Page.Site != null && this.Page.Site.DesignMode))
return true;
return false;
}
}
--
Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group

Future Business Model
Loan Origination Services
National City Mortgage
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top