Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Webcontrol Designer Awareness...

Reply
Thread Tools

Webcontrol Designer Awareness...

 
 
Weston Weems
Guest
Posts: n/a
 
      07-05-2005
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


 
Reply With Quote
 
 
 
 
Michael Baltic
Guest
Posts: n/a
 
      07-06-2005
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


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

 
Reply With Quote
 
 
 
 
Michael Baltic
Guest
Posts: n/a
 
      07-06-2005
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


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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom webcontrol that references another webcontrol Fabricio ASP .Net Building Controls 0 09-21-2005 02:55 AM
Trapping an Exception ocurring in a Webcontrol at the Page or parent WebControl level. ASP .Net 2 01-31-2005 06:34 PM
WebControl inside of WebControl and attaching events Kasabaarde Sumta ASP .Net Building Controls 0 12-13-2004 09:51 PM
WebControl with non-WebControl property Peter Morris [Air Software Ltd] ASP .Net Web Controls 1 12-07-2004 12:25 PM
Can a webcontrol (webcontrol.dll) have a configuration file? Luis Ramírez. ASP .Net Building Controls 2 07-06-2004 04:35 PM



Advertisments