473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

ASP.NET Custom control with collection property

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.BreadcrumbDe signer"),

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(" >> ");

}

}

}

}
--
Insert corny line here
Nov 18 '05 #1
2 1394
Hi,

you need to use some design time attribute. you can read about them on
MSDN:
http://msdn.microsoft.com/library/de.../en-us/cpguide
/html/cpconattributesdesign-timesupport.asp

or look at sample code :
http://www.asp-files.com/msg/391.html

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Thanks. It took a little time to figure it out, since the code changes
didn't show up right away in the designers I'd already created, but got it
figured out. Thanks again!

--
Insert corny line here
"Natty Gur" <na***@dao2com.com> wrote in message
news:eA**************@TK2MSFTNGP11.phx.gbl...
Hi,

you need to use some design time attribute. you can read about them on
MSDN:
http://msdn.microsoft.com/library/de.../en-us/cpguide
/html/cpconattributesdesign-timesupport.asp

or look at sample code :
http://www.asp-files.com/msg/391.html

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a...
2
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
0
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.