Custom Control within a Control Control

I am developing a custom controls that will render headers for different web sites.  Within these controls, I want to place another custom control that will change the language.  I created the language control and had it implement IPostBackDataHandler.  This control works fine if I drag it on a new web form, but if I tell a header custom control to render it problems occur.  The Language Selector custom control does not have a Page member anymore and the event handlers do not work.  Does anyone have any experience with doing something similiar?  Anyone have any suggestions?

Thanks,
Rich
0
rjl7002
8/12/2003 1:53:54 PM
asp.net.hosting-open-forum 4216 articles. 0 followers. Follow

2 Replies
1671 Views

Similar Articles

[PageSpeed] 29


Hate to see posts go unanswered, but can't really help without seeing some code. How are you declaring the Language Selector?

Steven Bey

Recursion: see Recursion
0
stevenbey
8/27/2003 3:25:38 PM
I agree that some code examples would be nice, but here's a suggestion. One thing I've found with embedded custom controls is that they usually don't render properly unless you've added the child control to the parent's control tree before you render the child. Try adding something like this to your header control, then render the child normally:

protected override void CreateChildControls()
{
this.Controls.Clear();
_langCtrl = new LanguageControl();
this.Controls.Add(_langCtrl);
}
Hope this helps,
Rob
0
HiTopTech
8/29/2003 3:23:33 PM
Reply:

Similar Artilces:

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

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

how to have both server controls and html controls rendered in a custom control?
I have a custom control in which there is an html text box.when you click on it , a div containing a table is appeared and according to what you select in that table a text is set to the text box. It works fine but the problem is: as the text box is an html element it doesn't have viewstate and when a post back occures in the page its value disappeares.I tried a hidden field to keep its value.again there is another problem : I put this custom control in a usercontrol and put the usercontrol in a multiview and by clicking on a button this view is selected and by clicking another bu...

How do I control one control from another control?
I have a page page1.aspx which is within a master page. On page I have a table with two cells. Within each cell I have placed two controls (ascx) that I have developed. Now I'd like to be able to get these two controls to interact. One needs to update the other. One has some search criteria that the other one needs to update its gridview. One needs to make the other visible/not visible at certain times. Out of the box neither control can see each other at all. Is there a good article or someplace I can find some information on how to do this?  AllAboutFocus.com. Information Technolo...

Handling events from controls within custom controls
Hi, I have created a custom control that behaves similar to a placeholder control. In the Render control I simply render the sub-controls that have been programiatically added, like this: protected override void Render(HtmlTextWriter writer){    foreach (Control control in Controls)    {        control.RenderControl(writer);    } ... This is fine. I can programatically add a button with an event handler to this control in the code behind for my ASPX page, and it works with no problem. However, if I add a...

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

Architecture: .Net Controls vs. Custom Controls
I'm interested in managing users. i.e. Logins and profiles, etc.My question is, should I be using things like the Login control or should I program these from scratch? I dont like the fact that .NET creates so many things for me. This level of abstraction terrifies me and it feels like I have no control over the code .I've done a few huge sites in Classic ASP (million-hits-per-day type sites) and I'm not sure how robust certain controls are, or when to use them.Is, for example, the Login control aimed at newbies to .NET? Should it be used for the larger projects with thousands of...

DW control in VB. NET custom control
Hi Just attempting to investigate some DW.NET aspects. In regards to building a ancestor object with VB.NET, why is when I create a datawindowcontrol custom control that any reference to it is like (assuming that u_dw is the name of the DW control): custom_control.u_dw.DatawindowObject = "myDW" instead of simply: u_dw.DatawindowObject = "myDW" If I create a .NET custom control with a button on it, I can directly reference the button's methods and properties without having to qualify it with the custom control's name. When I was developing with po...

Unable to use Custom Control within a datagrid control
I have a datagrid and a template field to look like this <asp:TemplateField> <ItemTemplate> <customControl:Display runat="server" Description='<%#DataBinder.Eval(Container.DataItem,"Description")%>' /> <asp:Label ID="mylabel" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"ReportID")%>' /> </ItemTemplate> </asp:TemplateField> My custom control has a property called "Description" which basically is nothing but the value for a label in that control. Now, in the above code, the asp label control correctly displays the text,...

Events and dynamically created controls (within a custom control)
I've created a custom control that displays a list of folders from a directory.  The user can click a folder (ImageButton) to drill-down and view the files within the folder.  I've developed the control by adding rows and cells to a <asp:Table>.  I create the controls within the cells (ImageButton and Labels) dynamically based on whether we want to see the folders or the files. Originally I was drawing the table depending on whether Folders or Files were desired but I realized that this will not work because on postback the target controls don't always exist...

How to Render controls within an UpdatePanel in a Custom Server Control
Hi,Im writting a CompositeControl that contains a few UpdatePanels (TabContainer with an UpdatePanel on each TabPanel to make Tab control panels load "on-demand"). I want to control the renderring of the controls within the UpdatePanel's ContentTemplateContainer.How should I implement the render method of my CompositeControl?Should I use a custom UpdatePanel (inherit from UpdatePanel and override the RenderContents method)? is there a simpler solution? (because I need a different "render" for each tab panel....)Thanks Tal88 Hi, I want to control the renderring o...

How do I get a reference to a wizard control within my custom control?
Hi, I want a custom control that will mimic the sidebar in the wizard control.In my composite custom control (OnPreRender / Render / RenderContent / CreateChildControls - it makes no difference where) I am trying the following:control c = FindControl("Wizard1");if (c != null){   wizard w = (wizard) c;   // work with steps, etc.} c is always null.  If I try to find a label control it finds the label control.   Why can I not get hold of the pages wizard control? Check out http://forums.asp.net/t/1107107.aspx it may help Try using Page.F...

ajax.net controls used in custom composite controls?
I am creating an events calendar that uses the accordion to display the events for the selected day.  The problem I'm having is that the accordion is not responding to any client side events.  I would really like to find a good "How to" article for building composite controls that incorporate an ajax.net control like the accordion....

Referencing controls in a custom control
I generate some warning string in a custom control i wrote, i want to show this warning string in another asp.net control how can i do it. thnaks for advance.  Best way would be to expose it via a public property in the custom control you wrote.Hanan Schwartzberg--------------------http://www.lionsden.co.il...

Web resources about - Custom Control within a Control Control - asp.net.hosting-open-forum

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

iHome unveils new SmartPlug model w/ power consumption tracking, remote control support
... the WiFi-enabled SmartPlug adds Siri automation to any two- or three-pronged accessory you have around the house. The accessory is controlled ...

Control Sphero’s awesome BB-8 droid with the upcoming Force Band
... with Spheros enormously fun BB-8 droid . And at CES 2016 in Las Vegas, the company announced that users will soon have another way to control ...

The Volkswagen Golf will get gesture controls
Filed under: 2016 CES , Volkswagen , Technology , Hatchback , Electric Want to see the new tech that's coming to Volkswagen models in the very ...

Now You Can Use Siri to Control Your Shades
... their Caséta Wireless Smart Bridge, a smart home device that could be used with their range of on/off and dimmer switches to give people control ...

Why Gun Control Laws Work Elsewhere But Are DOA In The USA
... lands with diverse populations and long histories of fidelity to the rule of law. Why then did Australia and the U.K. pass strict gun control ...

MLK Packed Heat But Obama Cites Him To Shame Gun Control Opponents
MLK Packed Heat But Obama Cites Him To Shame Gun Control Opponents

AT&T voice assistant helps you control your smart home
AT&amp;T's Digital Life home automation service is supposed to make your life easier, but it's been lagging a bit in the control department. ...

President Barack Obama Breaks Down in Tears While Announcing Plan for Gun Control
President Obama can't hold back the tears while recalling the Sandy Hook Elementary school shooting.

Indianapolis mom invited to White House for gun control announcement
WASHINGTON, D.C. (Jan. 5, 2016) - DeAndra Yates never intended to become an advocate for gun safety and gun violence victims. But the last two ...

Resources last updated: 1/6/2016 11:19:39 AM