hmm..so heres what i gather. This isnt going to be a fun task but i the only thing I can figure so far is actually running through the css yourself to find those webresource reference and replacing them with the return value of:
Which apparently returns a url as "mvwres:your.resource.blah" which can viewed at design time. so if this doesnt help you, i would say try looking into what that mvwres is all about. I dont have any CSS files that contain image resources that need to be
viewed at design time..my problem was actually with a static class that wrapped my resources for easy access was a null reference when in design time.
the only thing I can figure so far is actually running through the css yourself to find those webresource reference and replacing them with the return value of:
Congradulations on the success of solving the mystery. I know many have been looking for a way to accomplish this task, and appreciate the anwser. I will be implementing this now in my solutions. Thank You!
I have a working solution to the embedded image in an embedded stylesheet problem, but I would appreciate any suggestions for improvement. This does its own substitution of the CSS file in the Designer class for the IDE. Transparency in PNGs don't work
so far, however. I'll post some of the code here, but
a full example solution is available for download. I'd love to hear comments on this. Thank you!
#region Using directives using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; #endregion
namespace GizmonicInstitute.WebControls {
[Designer(typeof(SampleControlDesigner))] [DefaultProperty("TextBoxText")] [ToolboxData("<{0}:SampleControl runat=server></{0}:SampleControl>")] public class SampleControl : CompositeControl {
[Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Description("Gets or sets the text caption displayed in the Button control.")] public string LabelText { get { object o = ViewState["LabelText"]; return (o == null) ? String.Empty : (string)o; } set { ViewState["LabelText"] = value; RecreateChildControls(); } }
[Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Description("Gets or sets the text caption displayed in the Button control.")] public string TextBoxText { get { object o = ViewState["TextBoxText"]; return (o == null) ? String.Empty : (string)o; } set { ViewState["TextBoxText"] = value; RecreateChildControls(); } }
[Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Description("Gets or sets the text caption displayed in the Button control.")] public string ButtonText { get { object o = ViewState["ButtonText"]; return (o == null) ? String.Empty : (string)o; } set { ViewState["ButtonText"] = value; RecreateChildControls(); } }
ShadowLocke
Member
20 Points
8 Posts
Re: WebControl with embedded stylesheet rendering at design time
Aug 01, 2008 02:21 PM|LINK
hmm..so heres what i gather. This isnt going to be a fun task but i the only thing I can figure so far is actually running through the css yourself to find those webresource reference and replacing them with the return value of:
Which apparently returns a url as "mvwres:your.resource.blah" which can viewed at design time. so if this doesnt help you, i would say try looking into what that mvwres is all about. I dont have any CSS files that contain image resources that need to be viewed at design time..my problem was actually with a static class that wrapped my resources for easy access was a null reference when in design time.
JustinStolle
Member
17 Points
9 Posts
Re: WebControl with embedded stylesheet rendering at design time
Aug 01, 2008 02:59 PM|LINK
This would be fine I think, but how can you get a reference to the current Page from within the ControlDesigner to execute that code?
jkirkerx
Contributor
3733 Points
866 Posts
Re: WebControl with embedded stylesheet rendering at design time
Aug 01, 2008 05:15 PM|LINK
Congradulations on the success of solving the mystery. I know many have been looking for a way to accomplish this task, and appreciate the anwser. I will be implementing this now in my solutions. Thank You!
JustinStolle
Member
17 Points
9 Posts
Re: WebControl with embedded stylesheet rendering at design time
Aug 01, 2008 10:24 PM|LINK
I have a working solution to the embedded image in an embedded stylesheet problem, but I would appreciate any suggestions for improvement. This does its own substitution of the CSS file in the Designer class for the IDE. Transparency in PNGs don't work so far, however. I'll post some of the code here, but a full example solution is available for download. I'd love to hear comments on this. Thank you!
AssemblyInfo.cs (partial)
SampleControl.css
SampleControl.csSampleControlDesigner.cs
Composite Control Design Time Resources
samuelms
Member
4 Points
2 Posts
Re: WebControl with embedded stylesheet rendering at design time
Feb 20, 2009 05:15 AM|LINK
You are the MAN!!! I have been trying to figure this out for over a year!
Man... relief... *sigh*
JustinStolle
Member
17 Points
9 Posts
Re: WebControl with embedded stylesheet rendering at design time
Feb 20, 2009 09:00 AM|LINK