Home All Groups Group Topic Archive Search About

Webcontrol Designer Awareness...

Author
5 Jul 2005 8:59 PM
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

Author
6 Jul 2005 1:42 PM
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


Show quoteHide quote
"Weston Weems" wrote:

> 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
>
>
>
Author
6 Jul 2005 7:23 PM
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


Show quoteHide quote
"Weston Weems" wrote:

> 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
>
>
>