Creating Custom Controls With Custom Controls Inside Of Them

Hello, I am trying to create a custom control for creating tabs. The idea is that our designer can just use the control tags to generate the tabs.  The problem that I am running into is that I want to be able to have a custom control that allows any number of child custom controls. So there would be a TabContainer Control, and within that there would be any number of tabs.  The idea is similar to how an asp:DropDown list can have any number of ListItems within them.  Here is my code, any help is appreciated.

 

1    <!-- TAB CONTAINER  -->
2 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="TabContainer.ascx.vb" Inherits="CustomControls_TabContainer" %>
3 <div>
4
5 <ul class="tabs">
6 <asp:PlaceHolder ID="ph_list_items">
7
8 </asp:PlaceHolder>
9 </ul>
10
11 </div>
12
13 <!-- INDIVIDUAL TABS -->
14 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Tab.ascx.vb" Inherits="CustomControls_Tab" %>
15 <li>
16 <asp:HyperLink ID="hp_link" runat="server" />
17 </li>
18
19 <!-- PAGE SOURCE -->
20 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
21 <%@ Register
22 TagPrefix="uc"
23 TagName="TabContainer"
24 src="~\CustomControls\TabContainer.ascx" %>
25 <%@ Register
26 TagPrefix="uc"
27 TagName="Tab"
28 src="~\CustomControls\Tab.ascx" %>

29
30 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
31
32 <html xmlns="http://www.w3.org/1999/xhtml">
33 <head runat="server">
34 </head>
35 <body>
36 <form id="form1" runat="server">
37 <div>
38
39 <uc:TabContainer ID="tabs1" runat="server" IncludeArrows="True">
40 <uc:Tab ID="tab1" runat="server" LinkText="Tab1" LinkURL="http://www.google.com" />
41 <uc:Tab ID="tab2" runat="server" LinkText="Tab1" LinkURL="http://www.google.com" />
42 <uc:Tab ID="tab3" runat="server" LinkText="Tab1" LinkURL="http://www.google.com" />
43 </uc:TabContainer>
44 </div>
45 </form>
46 </body>
47 </html>
  For simplicity's sake I have left out the codebehind.
0
mateobus
10/14/2008 8:33:42 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

0 Replies
912 Views

Similar Articles

[PageSpeed] 8

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

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 You should be able to do ...

Custom controls called from inside other custom controls???
I'm fairly new to writing controls in ASP.NET so, forgive the I am trying to create a base page class which will call 3 custom controls. This base page class will span across multiple projects hence the reason I am not creating user controls. These 3 custom controls are: 1. TopNav-uses render method to display an HTML table with graphics for top navigation. 2. ImagePairs-uses prerender method to add javascript code to manage what graphic is displayed in TopNav onMouseOver and onMouseOut 3. MgrHeader-uses render method to display an HTML table with s...

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

Add .Net Control to Web Custom Control
 I want to add .NET Control (like: TextBox, Button...) to Web Custom Control.How i can do it? Alphavn That's called a composite control -- "Mark As Answer" if my reply helped you -- Hello Guys What gunteman said, that is one approach and in most cases the right one.But its also possible to add child controls to a Control thats inherit from WebControl itself. Be sure to implement INamingContainer to that inherited Control too, thats the important point of that approach.--Microsoft MVP - Visual Developer ASP / ASP.NET- http://www.aspnetzone.de/blogs/peterbuch...

Custom Databound Web Control with Dynamically Created Controls.
I have a conundrum, or perhaps I'm overcomplicating something that shouldn't be this difficult.  Likely the later.  I have created a control that inherits from WebControl.  I include it on my page (CDD), and on Page_Load set it's datasource and a few important properties. CDD.DataSource = resourcesXml; CDD.Levels.Add("/Resources/Resource", "RootDesc", "RootResourceID"); CDD.Levels.Add("Category", "CategoryDesc", "CategoryResourceID"); CDD.DataBind();  The problem is, that the control has ...

error parsing web control inside custom control
I have the following: ------------------------------------------------ <!-- page.aspx --> <%@ Page Language="C#" %> <%@ Register TagPrefix="MyTag" tagname="PageTemplate" Src="./Includes/DefaultPageTemplate.ascx" %> <script runat="server"> protected void Page_Load(Object Src, EventArgs E) { //!!!!!!!!!!!!!!!!!!!!!!!! label1.Text = "asdf"; //! the line above causes an error !!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!! } </script> <MyTag:PageTemp...

Custom Control within a Custom Control
I have two individual custom controls say custom cc1 and cc2. cc1 is communicating to cc2 using event delegate mechanism.I have tested the behaviour by dropping cc1 and cc2 onto a Web Page and it works fine. I want to create a third custom control say cc3 which should contain both cc1 and cc2. So that if i drag and drop cc3 onto a Web Page i can acheive exactly what i am doing above. The problem is that i am not sure how to call/register a custom control within a custom control ? Any clue ? Thanks!! Hi, Do you mean adding custom control to custom control? I think you can use the same wa...

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

Custom Server Control Vs Web Parts, Any need for Custom Server Control
Hello I've just posted a similar question on why you need server controls when you can pre-compile usercontrols and redistribute them. http://forums.asp.net/p/1397433/3010100.aspx#3010100 I've seen lots of (usercontrol vs web part) but not much on web part vs custom server control. According to the MSDN site you can put web parts onto a normal asp.net page outside of a web part zone and they behave just like custom server controls. So, if you are creating a bunch of controls for redistribution to customer asp.net sites and/or SharePoint sites why don't you just create Web Par...

Creating Custom Web Controls that Inherit from a Custom Base Class
Hi there,I have some existencial doubts, and hopefully someone can help me out with what I want to achieve.I need to create several custom web controls that share some common properties and methods. In nature, they are basically extensions to existing web controls like TextBox, DropDownList, etc., but with some extre properties: Options and Defaults. Basically what I need to do is to be able to handle this custom web controls in this way:  foreach(CustomBaseControl bc in ControlCollection) { bc.Options = yada yada; bc. Defaults = yada yada; } I don't want to go thr...

User Control VB.Net x Web Custom Control
I was thinking in create a user control in VB.Net, and use it in a Asp.Net as possible? So I thought about it is gonna be better than make a Web Custom Control, so i thought again, nope... But i need to know better because a don't have a progress bar in asp.net for example.... Could Somebody tell me about??? in a reallity i know the asnwer but i would like to explain by myself... Thank's Antonio...

How to create Web Custom controls in .Net 2005
  Hi All  Pls tell me the steps to create Web Custom controls in Asp.Net 2005HTHPlease: Don't forget to click "Mark as Answer" on the post that helped you. Psalm 23 : 1-2 1 The LORD is my shepherd, I shall not be in want. 2 He makes me lie down in green pastures,he leads me beside quiet waters. Learning everything about custom server controls is about a book's worth of information, namely: http://www.amazon.com/Developing-Microsoft-Controls-Components-Pro-Developer/dp/0735615829/ref=sr_1_5?ie=UTF8&s=books&qid=1222866550&sr=8-5Brian"Trust in t...

Custom User Controls and dynamically created web controls events not firing
I have a peculiar problem and since I am just starting to use .net I am confident I am doing something wrong, but I can't see it and I've wasted a lot of time so far trying to figure it out. Hopefully one of you can figure it out. I have a custom User Control and I am dynamically creating a RadioButtonList. If I remove the custom user control from the page the RadioButtonList works as expected and correctly. However, once I add the custom control, it does not fire the SelectedIndexChanged event. Below is some code. If all I do is remove: "<UC:TOPMENU id="TopMenu1"...

Web resources about - Creating Custom Controls With Custom Controls Inside Of Them - asp.net.web-forms

Wikipedia:Creating a bot - Wikipedia, the free encyclopedia
It is often far simpler to request a bot job from an existing bot. If you have only periodic requests or are uncomfortable with programming languages, ...

U.K. Woman Faces 20 Months For Creating Fake Facebook Accounts, Sending Herself Abusive Messages
A woman in Cornwall in the U.K. came up with a creative way to use Facebook to accelerate a family spat, and it earned her 20 months in prison. ...

Sandi Krakowski’s Tips for Creating Great Content
Quick tips to help you create great content for your business.

Bug - Creating a Video.Watches Action stopped working - Facebook-Entwickler
Since today executing a POST on a me/video.wacthes endpoints no longer works, it was working around 10 hours ago since then the call always returns ...

Facebook simplifies process for creating repeat events
Facebook introduced a new feature for events this week that allows users to quickly create a similar event as one they previously hosted or attended. ...

The Obama campaign won by creating their own Facebook, with unique features for political campaigns.
... seen as too dangerous to nominate someone who is so thoroughly narcissistic, arrogant and dishonest. The Obama campaign won basically by creating ...

Creating A Road Map To Market Your Startup
Spreading the word can be challenging when you’re new to an industry, don’t have a big budget, and have little helpbut it’s possible.You’ll need ...

Dance Machine - The Fun Video Editor for Creating Music Videos to share on Instagram, Facebook, Vine ...
Get Dance Machine - The Fun Video Editor for Creating Music Videos to share on Instagram, Facebook, Vine, and Twitter on the App Store. See screenshots ...

Creating Economic Dynamism: Joseph E. Stiglitz
DAVOS/SWITZERLAND, 25JAN13 - Joseph E. Stiglitz, Professor, Columbia University, USA talks during the session 'Creating Economic Dynamism' at ...

YouTube - Super Human Abilities: Tila Tequila Creating Energy Balls & Electricity Out of Thin Air!
Veröffentlicht am 24.04.2013 Hey Guys! For a long time now I have been able to do some pretty supernatural things that most would consider "SUPER ...

Resources last updated: 1/20/2016 11:53:20 AM