Web Custom Control within a Web Custom Control

I was wondering if this can be done and how. I've created a simple custom control that displays a header which is my first custom control. So I'm just a baby when it comes to this..

Within the header I currently have a property for breadcrumbs which is a string.

What I would like to do is have the breadcrumb property  be a Link Button List. I did find a custom control of a Link Button List which is exactly what I wanted. My question is how can/do  I include this into my custom control?

Can it done? How? Please help? I'm at a lose here.

 

Susan

0
sbrazier
3/1/2006 4:42:07 PM
📁 asp.net.web-forms
📃 93655 articles.
⭐ 6 followers.

💬 2 Replies
👁️‍🗨️ 1534 Views

You should be able to do this.  Although I'm using ASP.NET 2.0, there's no reason why earlier versions shouldn't allow it.  For example (again in ASP.NET 2.0, so try to interpret this for the version you're using):

[Web UserControl 2]

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Custom2.ascx.cs" Inherits="Custom2" %>

<table border="1">

<tr>

<td>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

</td>

</tr>

</table>

[Web UserControl 1 -- using Web UserControl 2]

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Custom1.ascx.cs" Inherits="Custom1" %>

<%@ Register Src="Custom2.ascx" TagName="Custom2" TagPrefix="uc1" %>

<table border="1">

<tr>

<td>

<uc1:Custom2 ID="Custom2_1" runat="server" />

<br />

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<br />

<asp:Button ID="Button1" runat="server" Text="Button" />

</td>

</tr>

</table>

[Webpage using UserControl 1]

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="zzzz.aspx.cs" Inherits="zzzz"

MaintainScrollPositionOnPostback="true" %>

<%@ Register Src="Custom1.ascx" TagName="Custom1" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<uc1:Custom1 ID="Custom1_1" runat="server" />

</form>

</body>

</html>

0
jcasp
3/1/2006 9:19:43 PM
Thanks for your response. However, my focus is on Custom Controls not user controls. Which are different.
0
sbrazier
3/1/2006 11:44:47 PM
Reply: