|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
IExtenderProviderI have a asp.net contol that implements IExtenderProvider, I notice however that the extra property it adds only works for controls in the WebControl namespace and not those in the HtmlControl namespace. This is not a big issue however as I can handle this in my customised settings collection using TypeConvertors. However what I'd like to do is add a couple of verbs (perhaps) to this control that will allow me to toggle which controls are handled by changing the background colour (via the styles perhaps). It seems that I can change the style of the controls that are in the WebControl namespace but not those in the HtmlControl namespace. I also notice that even though the colour changes on the controls on the WebControls this style change is not persisted on the page. 2 questions; 1) how do I change the style of controls in the HtmlControl namespace from my custom control? 2) how do I persist these changes to the page? Regards Shaun Wilde Hi Shaun,
Welcome to ASP.NET newsgroup. From your description, you're meeting some problems when developing a custom IExtenderProvider component which used to set Style for Webcontrols in your composite control? As for the two questions you mentioned: ================== 1) how do I change the style of controls in the HtmlControl namespace from my custom control? 2) how do I persist these changes to the page? ================= 1) For HtmlXXXControls under the HtmlControls namespace, since they're directly mapped to the html elements and don't have those encapsulated Style Properties (like the Color, BackColor as WebControls), we should directly use the Style property to set any css or html style as we need. The "Style" property is a string based key/value collection which help us define various html attributes for the control #HtmlControl.Style Property http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIHtmlContr olsHtmlControlClassStyleTopic.asp?frame=true 2), as for persisting changes, I'm not sure what's your detailed code logic, however based on my research the IExenderProvider interface is not quite designed for using for WebControls and is more recommended to use in winform design-time environment. And here is the codeproject article which has mentioned this limitation of the IExtenderProvider component wokring in VS.NET2003 for webcontrols: #Extender provider components in ASP.NET: an IExtenderProvider implementation http://www.codeproject.com/aspnet/ExtenderProviderComponent.asp It has mentioned a certain workaround, but I still feel it better to avoid using it for our custom webcontrols. Thanks, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- Show quoteHide quote | Thread-Topic: IExtenderProvider microsoft.public.dotnet.framework.aspnet.webcontrols:9884| thread-index: AcWHfNH9bnYvKqr7S5KKPFmakb3FQA== | X-WBNR-Posting-Host: 195.92.40.49 | From: "=?Utf-8?B?U2hhdW4gV2lsZGU=?=" <shaun_wilde@nospam.nospam> | Subject: IExtenderProvider | Date: Wed, 13 Jul 2005 00:31:01 -0700 | Lines: 24 | Message-ID: <2ACBE918-6FB7-4923-9B12-45BB1E035***@microsoft.com> | MIME-Version: 1.0 | Content-Type: text/plain; | charset="Utf-8" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Content-Class: urn:content-classes:message | Importance: normal | Priority: normal | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl Show quoteHide quote | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols | | Hi | | I have a asp.net contol that implements IExtenderProvider, I notice however | that the extra property it adds only works for controls in the WebControl | namespace and not those in the HtmlControl namespace. This is not a big issue | however as I can handle this in my customised settings collection using | TypeConvertors. However what I'd like to do is add a couple of verbs | (perhaps) to this control that will allow me to toggle which controls are | handled by changing the background colour (via the styles perhaps). It seems | that I can change the style of the controls that are in the WebControl | namespace but not those in the HtmlControl namespace. I also notice that even | though the colour changes on the controls on the WebControls this style | change is not persisted on the page. | | 2 questions; | | 1) how do I change the style of controls in the HtmlControl namespace from | my custom control? | | 2) how do I persist these changes to the page? | | Regards | | Shaun Wilde | Hi Steven
Unfortunately changing the Style tag for the HTML Control does not persist on the page Here is a code snippet of what I am doing when I change the Highlight property in design view Dim ctrl As Control = FindControlInContainers(setting.Control) If TypeOf ctrl Is WebControl Then If EnableHighlight Then CType(ctrl, WebControl).BackColor = HighlightColour Else CType(ctrl, WebControl).BackColor = System.Drawing.Color.Empty End If NotifyDesignerOfChange(ctrl) ElseIf TypeOf ctrl Is HtmlControls.HtmlControl Then If EnableHighlight Then CType(ctrl, HtmlControls.HtmlControl).Style("background-color") = HighlightColour.Name Else CType(ctrl, HtmlControls.HtmlControl).Style.Remove("background-color") End If NotifyDesignerOfChange(ctrl) End If not sure what to do as the HtmlControl does not show any effect and the change to this control is not persisted to the page unlike the WebControls Thankx for the links - I had already seen the codeproject article and used parts of it 'NotifyDesignerOfChange' Any further advice? Shaun Show quoteHide quote "Steven Cheng[MSFT]" wrote: > Hi Shaun, > > Welcome to ASP.NET newsgroup. > From your description, you're meeting some problems when developing a > custom IExtenderProvider component which used to set Style for Webcontrols > in your composite control? > > As for the two questions you mentioned: > ================== > 1) how do I change the style of controls in the HtmlControl namespace from > my custom control? > > 2) how do I persist these changes to the page? > ================= > > 1) For HtmlXXXControls under the HtmlControls namespace, since they're > directly mapped to the html elements and don't have those encapsulated > Style Properties (like the Color, BackColor as WebControls), we should > directly use the Style property to set any css or html style as we need. > The "Style" property is a string based key/value collection which help us > define various html attributes for the control > > #HtmlControl.Style Property > http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIHtmlContr > olsHtmlControlClassStyleTopic.asp?frame=true > > 2), as for persisting changes, I'm not sure what's your detailed code > logic, however based on my research the IExenderProvider interface is not > quite designed for using for WebControls and is more recommended to use in > winform design-time environment. And here is the codeproject article which > has mentioned this limitation of the IExtenderProvider component wokring in > VS.NET2003 for webcontrols: > > #Extender provider components in ASP.NET: an IExtenderProvider > implementation > http://www.codeproject.com/aspnet/ExtenderProviderComponent.asp > > It has mentioned a certain workaround, but I still feel it better to avoid > using it for our custom webcontrols. > > Thanks, > > Steven Cheng > Microsoft Online Support > > Get Secure! www.microsoft.com/security > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > > > > -------------------- > | Thread-Topic: IExtenderProvider > | thread-index: AcWHfNH9bnYvKqr7S5KKPFmakb3FQA== > | X-WBNR-Posting-Host: 195.92.40.49 > | From: "=?Utf-8?B?U2hhdW4gV2lsZGU=?=" <shaun_wilde@nospam.nospam> > | Subject: IExtenderProvider > | Date: Wed, 13 Jul 2005 00:31:01 -0700 > | Lines: 24 > | Message-ID: <2ACBE918-6FB7-4923-9B12-45BB1E035***@microsoft.com> > | MIME-Version: 1.0 > | Content-Type: text/plain; > | charset="Utf-8" > | Content-Transfer-Encoding: 7bit > | X-Newsreader: Microsoft CDO for Windows 2000 > | Content-Class: urn:content-classes:message > | Importance: normal > | Priority: normal > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl > | Xref: TK2MSFTNGXA01.phx.gbl > microsoft.public.dotnet.framework.aspnet.webcontrols:9884 > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols > | > | Hi > | > | I have a asp.net contol that implements IExtenderProvider, I notice > however > | that the extra property it adds only works for controls in the WebControl > | namespace and not those in the HtmlControl namespace. This is not a big > issue > | however as I can handle this in my customised settings collection using > | TypeConvertors. However what I'd like to do is add a couple of verbs > | (perhaps) to this control that will allow me to toggle which controls are > | handled by changing the background colour (via the styles perhaps). It > seems > | that I can change the style of the controls that are in the WebControl > | namespace but not those in the HtmlControl namespace. I also notice that > even > | though the colour changes on the controls on the WebControls this style > | change is not persisted on the page. > | > | 2 questions; > | > | 1) how do I change the style of controls in the HtmlControl namespace > from > | my custom control? > | > | 2) how do I persist these changes to the page? > | > | Regards > | > | Shaun Wilde > | > > Thanks for your followup Shaun,
For design-time style property persistence, htmlcontrols has different mechanism since html server control's style are directly applied as normal html code in the html element in aspx template. And those style won't be parsed by asp.net runtime. Currently, what I'm thinking is that since your control is a custom composite control which contains some htmlcontrols as child controls, is it ok that you persist those html control's style setting as propeties of the parent asp.net server control which can be persisted correctly. Thus, we can apply these settings to html controls at runtime in our control creating code logic. Thanks, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- | Thread-Topic: IExtenderProvider <Mu1d$a5hFHA.***@TK2MSFTNGXA01.phx.gbl>| thread-index: AcWNzNm1LTuVewJmQLSsbN8D+aMFuw== | X-WBNR-Posting-Host: 195.92.40.49 | From: "=?Utf-8?B?U2hhdW4gV2lsZGU=?=" <shaun_wilde@nospam.nospam> | References: <2ACBE918-6FB7-4923-9B12-45BB1E035***@microsoft.com> Show quoteHide quote | Subject: RE: IExtenderProvider microsoft.public.dotnet.framework.aspnet.webcontrols:10020| Date: Thu, 21 Jul 2005 01:19:01 -0700 | Lines: 149 | Message-ID: <41CF744F-F365-4B3F-80A6-0ECE98FFC***@microsoft.com> | MIME-Version: 1.0 | Content-Type: text/plain; | charset="Utf-8" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Content-Class: urn:content-classes:message | Importance: normal | Priority: normal | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl Show quoteHide quote | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIHtmlContr| | Hi Steven | | Unfortunately changing the Style tag for the HTML Control does not persist | on the page | | Here is a code snippet of what I am doing when I change the Highlight | property in design view | | Dim ctrl As Control = FindControlInContainers(setting.Control) | | If TypeOf ctrl Is WebControl Then | If EnableHighlight Then | CType(ctrl, WebControl).BackColor = HighlightColour | Else | CType(ctrl, WebControl).BackColor = | System.Drawing.Color.Empty | End If | NotifyDesignerOfChange(ctrl) | ElseIf TypeOf ctrl Is HtmlControls.HtmlControl Then | If EnableHighlight Then | CType(ctrl, | HtmlControls.HtmlControl).Style("background-color") = HighlightColour.Name | Else | CType(ctrl, | HtmlControls.HtmlControl).Style.Remove("background-color") | End If | NotifyDesignerOfChange(ctrl) | End If | | not sure what to do as the HtmlControl does not show any effect and the | change to this control is not persisted to the page unlike the WebControls | | Thankx for the links - I had already seen the codeproject article and used | parts of it 'NotifyDesignerOfChange' | | Any further advice? | | Shaun | | "Steven Cheng[MSFT]" wrote: | | > Hi Shaun, | > | > Welcome to ASP.NET newsgroup. | > From your description, you're meeting some problems when developing a | > custom IExtenderProvider component which used to set Style for Webcontrols | > in your composite control? | > | > As for the two questions you mentioned: | > ================== | > 1) how do I change the style of controls in the HtmlControl namespace from | > my custom control? | > | > 2) how do I persist these changes to the page? | > ================= | > | > 1) For HtmlXXXControls under the HtmlControls namespace, since they're | > directly mapped to the html elements and don't have those encapsulated | > Style Properties (like the Color, BackColor as WebControls), we should | > directly use the Style property to set any css or html style as we need. | > The "Style" property is a string based key/value collection which help us | > define various html attributes for the control | > | > #HtmlControl.Style Property | > Show quoteHide quote | > olsHtmlControlClassStyleTopic.asp?frame=true | > | > 2), as for persisting changes, I'm not sure what's your detailed code | > logic, however based on my research the IExenderProvider interface is not | > quite designed for using for WebControls and is more recommended to use in | > winform design-time environment. And here is the codeproject article which | > has mentioned this limitation of the IExtenderProvider component wokring in | > VS.NET2003 for webcontrols: | > | > #Extender provider components in ASP.NET: an IExtenderProvider | > implementation | > http://www.codeproject.com/aspnet/ExtenderProviderComponent.asp | > | > It has mentioned a certain workaround, but I still feel it better to avoid | > using it for our custom webcontrols. | > | > Thanks, | > | > Steven Cheng | > Microsoft Online Support | > | > Get Secure! www.microsoft.com/security | > (This posting is provided "AS IS", with no warranties, and confers no | > rights.) | > | > | > | > -------------------- | > | Thread-Topic: IExtenderProvider | > | thread-index: AcWHfNH9bnYvKqr7S5KKPFmakb3FQA== | > | X-WBNR-Posting-Host: 195.92.40.49 | > | From: "=?Utf-8?B?U2hhdW4gV2lsZGU=?=" <shaun_wilde@nospam.nospam> | > | Subject: IExtenderProvider | > | Date: Wed, 13 Jul 2005 00:31:01 -0700 | > | Lines: 24 | > | Message-ID: <2ACBE918-6FB7-4923-9B12-45BB1E035***@microsoft.com> | > | MIME-Version: 1.0 | > | Content-Type: text/plain; | > | charset="Utf-8" | > | Content-Transfer-Encoding: 7bit | > | X-Newsreader: Microsoft CDO for Windows 2000 | > | Content-Class: urn:content-classes:message | > | Importance: normal | > | Priority: normal | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl | > | Xref: TK2MSFTNGXA01.phx.gbl | > microsoft.public.dotnet.framework.aspnet.webcontrols:9884 | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols | > | | > | Hi | > | | > | I have a asp.net contol that implements IExtenderProvider, I notice | > however | > | that the extra property it adds only works for controls in the WebControl | > | namespace and not those in the HtmlControl namespace. This is not a big | > issue | > | however as I can handle this in my customised settings collection using | > | TypeConvertors. However what I'd like to do is add a couple of verbs | > | (perhaps) to this control that will allow me to toggle which controls are | > | handled by changing the background colour (via the styles perhaps). It | > seems | > | that I can change the style of the controls that are in the WebControl | > | namespace but not those in the HtmlControl namespace. I also notice that | > even | > | though the colour changes on the controls on the WebControls this style | > | change is not persisted on the page. | > | | > | 2 questions; | > | | > | 1) how do I change the style of controls in the HtmlControl namespace | > from | > | my custom control? | > | | > | 2) how do I persist these changes to the page? | > | | > | Regards | > | | > | Shaun Wilde | > | | > | > |
Please Help: ListBox.SelectedItem returns null
Can aspnet simulate windows pane separator? Error: Multiple controls with the same ID ListItem individual Color a dropdown list in the "Properties" window Web User Controls: Exposing Items property of contained controls Collection with the correct object type on the Collection dialog DropDownList <optgroup> asp.net 2.0: Webcontrols in Library validator for drop down list box |
|||||||||||||||||||||||