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. Follow

2 Replies
1319 Views

Similar Articles

[PageSpeed] 5

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:

Similar Artilces:

Custom Web Control inside another Custom Web Control
Hi I created a custom web control (CusWebNew) that displays some textboxes by adding them to the ControlCollection of the webcontrol. I also created a custom webcontrol (CustWebButton) that inherts from Button control, and overrided the OnClick function. When I use CustWebButton on a regular web form, it seems to function correctly. However, when I added to be part of the ControlCollection of CustWebNew, it stops to work.   Any ideas why? Thanks Hey, What do you mean by stops to work?  Explain what you are trying to do with it and what it doesn't do.Brian"Trust in the...

Reusing custom web control in the same web control
Hello, I'm newbie in web development and of course asp.net. I am actually trying to build my first page and I'd like to know if it is possible to make a custom webcontrol that will contain itself. Let's say I want to draw a folder hierarchy in treeview-like structure. I thought I could make a control that will display a folder and if this folder contains subfolders then for each the control will include itself. Is this even possible? What would you suggest me to do to? Thanks in advance. TomTom Hagen http://thagen.dteam.info If the control can have child controls, then I s...

What is the difference between a Web User Control and a Web Custom Control
Hi ,please could you answer for the following question with example. i know wht they are. but i want to know hw they are existing in web pages with simple example. What is the difference between a Web User Control and a Web Custom Control?  Thanks in AdvanceDilip    Check this out .... hope these might help you out... http://support.microsoft.com/kb/893667http://msdn2.microsoft.com/en-us/library/aa651710(VS.71).aspx itsUrDAY  Hi, See the following URLs: https://msdn2.microsoft.com/en-us/library/fb3w5b53(VS.71).aspx(Introduction to Web User Contr...

Server Web User Control or Web Custom Control
Ok, I made a DataGrid I like, stuck it in a Web Control Lib, and then to my toolbar. Now I want to take my nice little control and add it to a greater control, maybe place some buttons around it etc. I could always inherit from it in a new custom control and dynamically add the buttons, but I thought about using a Web User Control. I thought I could easily create a Web User Control, drop on my grid and the buttons on a form, and expose some properties and events, but once I got into it, I got a feeling that this isn't what a Web User Control is for. When designing a control li...

Use Web Custom control or Web User control?
Friends,  I have a generic aspx page and its functions which is used in many .NET web application. The generic page contains a HTML Div control, server drop down list, server buttons, server textbox and it have different server and client functions to do its tasks for calling aspx pages in web applications. My problem is I do not know whether I should make that generic page as a web user control (but this is tedious because all other application folders must store frontpage aspx and code behind files of the generic page) or as a web custom control (This seems to be good beca...

custom web user control and web form
Guys,          I am trying to develop a context menu control for all of my pages. what i am trying to do is that i want the control to pick a datasource from the markup and then check whether its an xml file or a datatable. I created a class called datasource.   /**************************DataSource Class****************************/  public class DataSource { /// <summary> /// This is to identify unique elements from the markup /// </summary>protected string _ID; /// <summary> /// This will be the Datasource ID e...

I cannot drag web custom controls from toolbox to web form
I have created some web custom controls (both composite controls or derived/inherited controls).  I successfully added them to the toolbox. However, when I try to drag them onto the form, the cursor changes into a black circle with a diagonal line, and cannot drag them.  I also tried double-clicking them from the toolbox but it still won't work. I sent the Control Library (DLL) to a friend, and he managed to use it properly.  I am assuming this is a problem with my Visual Studio. Has anyone encountered such a problem?  Any suggestions or solutions?   Thanks. I...

what is the difference between web custom control,web user control,component class
please tell me in detail what is the web custom control,web user control,component class and what is the difference between web custom control, web user control,component class and when to use web custom control, when to use web user control, when to use component class Oh gosh. Such a nice question! I recommend you to start with this link from MSDN click here . I think you'll need a lot of coffe :) .George (.NET or .NOT) www.piasi.org...

Cant drag-and-drop Web Custom Control to Web Form!
Hi,I'm going insane here, I've read countless articles how to create a Web Custom Control and add it to the Toolbox and then just Drag-and-Drop it to a Web Form.And I have done exactly that except for the last step, any Web Custom Control I create refuses to be Drag-and-Dopped to the Web Form. What happens is the following, after I have added the Web Custom Control to the ToolBox I click it and drag it to the Web Form designer area. First I can see the icon of the Web Custom Control and I see a Referance being created but just after that the icon changes to one of those "you cant park here s...

Web control in web control
Hi,There are two simple web user controls A and B, where B contains A. They just display the bunch of text boxes, so I do not need them even in tool pane. They sit in the same project next to web form.I noticed that web user control put on ASPX page does not appear in code behind, but if I create it with protected keyword and name being exactly the same as id it works fine. I can access such a web control from code behind and see the value assigned in IE. The problem is that the same routine does work for my A web control in B. When I assign the value IE, I keep getting null reference. ...

Is it possible to have a web custom control( not a user control) in the app_code folder of a web project?
Or must it be inside a class library by itself? Do you compile the web site to get the dll then add that to the toolbar? Yes you can find the info here:http://alpascual.com/blog/al/archive/2006/06/19/The-power-of-CompositeControl.-Another-skeleton-class-.aspxCheersAlMy BlogMapStats.NETPlease click on 'Mark as Answer' if this post answered your question! Sorry, I'm not following. What does extending a composite control illustrate about creating a custom web control inside the appcode folder of web project....

Controlling web control instances on Web Form
I have created a composite control, extending functionality of the Hidden Control. However, I would like to prevent the user from adding this control to the page multiple times. I only want one instance of the control on the Web Form. What setting in my project to I adjust to enable this functionality? I can not find it in any of the books that I have referenced. Is this a setting or is this code that has to be added to the inheriting class. Looks like there is no standard apporach. But I'd consider using static field to count number of created objects and throw exception if second object ...

Custom User Controls v. Custom Web Controls
Hi! Is it better for me to begin coding my controls instead of just designing them? What would the benefits be? I meen, i seem to be able to get all i need from just putting stuff together on an ASCX file but i'm obviously missing a huge concept here... please explain! Hi, creating user controls is indeed easier than creating custom server controls because you can simply drag & drop other controls on the form, easily add events to it, ... Custom controls however are better when you want to reuse them in several other projects. I like to create custom controls for small, reusable com...

Web.config AND Custom Web Controls
Hi, I've got defined a key with a value in web.config file and I want to read this value from a web control CS file (ConfigurationSettings.AppSettings["key"]). When the app is running, everything seems to be right, but the value is empty. Is it possible to access web.config values from web control files? Martin...

Web resources about - Web Custom Control within a Web Custom Control - asp.net.web-forms

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

DFES downgrades bushfire in Dunsborough as it is contained, but not under control
A BUSHFIRE south of Dunsborough has been contained but is not yet under control.

Queensland police shut down out-of-control party in Berserker, Rockhampton
Police shut down a party of 150 young people who had gathered at a house in Berserker, Rockhampton on Friday night.

Contextual and Granular Notification Controls
... written a lot about notifications, at one point calling the notifications screen “my home screen.” But I don’t like how we are forced to control ...

ESI cost control and networks
There is an interesting discussion thread on Twitter about how the way Medicare for All saves money is by significantly reducing provider, device, ...

US Democratic debate: Candidates spar on gun control
Candidates in the Democratic race for the White House hold their liveliest TV debate yet, clashing over gun control and healthcare among other ...

Doro PDF printer adds color conversion, page rotation controls
Lightweight virtual PDF printer Doro has been updated with new color conversion and page rotation settings. If the default "UseDeviceIndependentColor" ...

While No One Was Watching, Obama Took Control of the Courts
... and President Obama’s legacy.” It didn’t favor conservatives but there was a dramatic shift to the far left. The appellate is under the control ...

Sanders Backs Gun Control Legislation Ahead of Democratic Debate
Hillary Clinton's campaign calls her rival's move a "debate-eve conversion."

Apple has landed a very rare sponsorship deal to ensure it has control of the hottest ticket in San Francisco ...
Apple has signed up for the first time to become a sponsor of the Super Bowl Host Committee, Daniel Roberts at Yahoo Finance reported. It's ...

Resources last updated: 1/19/2016 11:08:08 AM