Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
ASP.NET Custom control with collection property
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="-=Chris=-, post: 377062"] Hello all, I've designed a custom bread crumb control for several of my asp.net projects. The default property of this control is a custom HyperLinkCollection I've created, which contains, you guessed it, HyperLink objects. All of it works great if I create/assign the links at runtime in code. I'd like to be able to assign links at design time, which is possible using the properties window, but currently, they do not carry over to the runtime. I'm trying to figure out how to make this happen. Sample code for the small breadcrumb class is listed below. I would greatly appreciate any input. using System; using System.Collections; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; namespace Com.L3Software.Web.Controls { /// <summary> /// Summary description for Breadcrumb. /// </summary> [DefaultProperty("Crumbs"), Designer("Com.L3Software.Web.Controls.BreadcrumbDesigner"), ToolboxData("<{0}:Breadcrumb runat=server></{0}:Breadcrumb>"), Description("A reusable breadcrumb component")] public class Breadcrumb : System.Web.UI.WebControls.WebControl, INamingContainer { private HyperLinkCollection mCrumbs; [Bindable(false), Category("Appearance"), Description("An ordered list of links to be displayed")] public HyperLinkCollection Crumbs { get { return this.mCrumbs; } } public Breadcrumb() { this.mCrumbs = new HyperLinkCollection(); } /// <summary> /// Render this control to the output parameter specified. /// </summary> /// <param name="output"> The HTML writer to write out to </param> protected override void Render(HtmlTextWriter output) { output.Write("You are here: "); for (int i=0; i<this.mCrumbs.Count; i++) { HyperLink l = (HyperLink)this.mCrumbs[i]; l.RenderControl(output); if (i < this.mCrumbs.Count-1) output.Write(" >> "); } } } }[/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
ASP.NET Custom control with collection property
Top