|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Webcontrol Designer Awareness...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 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? -- Show quoteHide quoteStaff 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 > > > 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; } } -- Show quoteHide quoteStaff 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 > > >
I guess this can't be done can it ?
Unhappy call to a 2nd dataItem in ItemTemplate of an asp:TemplateC Re: accessibility and asp:button OWC11 (connect Spreadsheet + Chart) Page is not submitted using Client side validation of.NET validato Button to link with DataGrid Register directive for custom web control in VS 2005 Beta 2 accessing a specific cotrol from web DataGrid control. Textbox question (v2.0) Tooltip for listbox and combobox |
|||||||||||||||||||||||