Glad to hear from you Paul,
If you get any progress, please feel free to post here.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Paul Yanzick" <Aragorn@newsgroups.nospam>
| References: <#F19WKMDGHA.984@tk2msftngp13.phx.gbl>
<P7GiphQDGHA.1240@TK2MSFTNGXA02.phx.gbl>
<KiehPXTEGHA.1888@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Composite Control and accessing complex properties of child
controls - C# VS2005
| Date: Fri, 6 Jan 2006 15:48:44 -0600
| Lines: 226
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#5xfHswEGHA.472@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| NNTP-Posting-Host: host-189-156-220-24.midco.net 24.220.156.189
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingcontrols:14241
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
| Hello,
|
| Sorry I haven't replied. Was preoccupied with some other projects.
|
| I believe that this will help, thank you! I think I tried something
along
| the same lines, but what you have here is slightly different so I will
give
| that a shot.
|
| Thanks!
| Paul
[quoted text, click to view] | "Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
| news:KiehPXTEGHA.1888@TK2MSFTNGXA02.phx.gbl...
| > Hi Paul,
| >
| > Does my suggestion in last reply helps a little? If there're anything
else
| > we can help, please feel free to post here.
| >
| > Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure!
www.microsoft.com/security | > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | X-Tomcat-ID: 100390610
| > | References: <#F19WKMDGHA.984@tk2msftngp13.phx.gbl>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: stcheng@online.microsoft.com (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Fri, 30 Dec 2005 06:15:04 GMT
| > | Subject: RE: Composite Control and accessing complex properties of
child
| > controls - C# VS2005
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > | Message-ID: <P7GiphQDGHA.1240@TK2MSFTNGXA02.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > | Lines: 128
| > | Path: TK2MSFTNGXA02.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.buildingcontrols:14202
| > | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
| > |
| > | Hi Paul,
| > |
| > | Welcome to ASPNET newsgroup.
| > | From your description, you're developing an ASP.NET 2.0 Custom
WEbServer
| > | control which using Composite control style and will contain some sub
| > | controls like Calendar... Now you're wondering how to add some public
| > | style properties in your custom control (mapping to some of the
| > contained
| > | sub control's properties ) and can utilize the design-time services ,
| > yes?
| > |
| > | Based on my experience, the simplest and quickest means is just
defining
| > | some public properties(of the same type of those in the sub
| > controls....)
| > | in your custom control. To utilize VS ide's design-time feautre, we
need
| > to
| > | apply some certain attributes. I've just created a simple composite
| > control
| > | which contains a Calendar control and expose a "CalendarDayStyle"
| > property
| > | to let end user configure inner Calendar control's daystyle through
our
| > | custom control's property. The "CalendarDayStyle" can be configured
| > | through design-time property grid or in aspx template.... We can
| > retrieve
| > | the value at runtime and merge with the inner calendar's style....:
| > |
| > | ====================================
| > | namespace ControlLib
| > | {
| > | [DefaultProperty("Text")]
| > | [ToolboxData("<{0}:MultiCS runat=server></{0}:MultiCS>")]
| > | [Designer(typeof(MultiCSDesigner),typeof(IDesigner))]
| > | public class MultiCS : WebControl, INamingContainer
| > | {
| > | private Calendar _calendar = null;
| > |
| > | private TableItemStyle _calendarDayStyle = null;
| > |
| > |
| > |
| > |
| >
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
| > | PersistenceMode(PersistenceMode.InnerProperty),
| > | DefaultValue((string)null), NotifyParentProperty(true)]
| > | public TableItemStyle CalendarDayStyle
| > | {
| > | get {
| > |
| > | if (this._calendarDayStyle == null)
| > | {
| > | this._calendarDayStyle = new TableItemStyle();
| > | }
| > | return this._calendarDayStyle;
| > | }
| > | }
| > |
| > |
| > |
| > |
| > | [Bindable(true)]
| > | [Category("Appearance")]
| > | [DefaultValue("")]
| > | [Localizable(true)]
| > | public string Text
| > | {
| > | get
| > | {
| > | String s = (String)ViewState["Text"];
| > | return ((s == null) ? String.Empty : s);
| > | }
| > |
| > | set
| > | {
| > | ViewState["Text"] = value;
| > | }
| > | }
| > |
| > |
| > |
| > |
| > | protected override void CreateChildControls()
| > | {
| > | Controls.Clear();
| > |
| > | _calendar = new Calendar();
| > | _calendar.ID = "cdrMain";
| > | _calendar.SelectedDate = DateTime.Now;
| > | _calendar.VisibleDate = DateTime.Now;
| > |
| > | Controls.Add(_calendar);
| > | }
| > |
| > |
| > | protected override void OnPreRender(EventArgs e)
| > | {
| > | base.OnPreRender(e);
| > |
| > | _calendar.DayStyle.MergeWith(_calendarDayStyle);
| > | }
| > | }
| > |
| > |
| > | public class MultiCSDesigner : ControlDesigner
| > | {
| > | public override string GetDesignTimeHtml()
| > | {
| > | StringBuilder sb = new StringBuilder();
| > | sb.Append("<font size='30' red='red'>");
| > | sb.Append("MultiCS DesignTime......");
| > | sb.Append("</font>");
| > |
| > | return sb.ToString();
| > | }
| > |
| > |
| > | }
| > | }
| > | ===================================
| > |
| > | Hope helps. Thanks,