Custom Server Control With Child Control

All,

I am currently putting together a very simple control. The new control outputs a table with two rows. The top row contains a heading and the bottom row will contain any other content. The control as it stands works perfectly well and I can place text into the content row no problem.
Now, to the problem. Once I'd completed the control I figured it would be neat to enable the developer to add controls directly into the bottom row (content row) of the outputted table. As you probably know the WebControl class has a Controls collection which the developer can use to add any other subordinate controls. So in the Render method of the control I enumerate the Controls collection on the custom control and add the controls (if any) to the content row (cell). As far as I can tell this works fine. I have my custom control which is dynamically loaded, I then dynamically load a user control into the Controls collection of the custom control and everything renders just fine. However, on my user control I have a couple of fields with required field validators and a button (login / password). The onclick event of the button should contain some asp.net generated JScript which is used to call the validator, but it doesnt, it's missing. The fields are still validated but only on a submit.
I have tested the user control as a stand alone control just dropped onto the page and the validation works fine.
Can anyone throw any light on this particular issue?
Thanks.
0
AndrewBuxton
2/22/2005 2:00:53 PM
asp.net.hosting-open-forum 4216 articles. 0 followers. Follow

0 Replies
1038 Views

Similar Articles

[PageSpeed] 52

Reply:

Similar Artilces:

Templated Custom Control not updating host designer.cs file with child server control variables.
Hello, I have a custom web control that acts as a collapsable gradient header and containter all in one. I followed the MS example closly and got a decent control that works well. But then I ran into a problem, if I add another nested server control to the content area of my custom control on any given page, it doesn't add the protected cooresponding variabe in the pages designer code module. Below is an example of the problem, in the page TestPage.aspx the nested control "TextBox1" should show up in the TestPage.aspx.designer.cs but does not. I have a feeling that this ha...

Custom Server Control with Child Controls
I have a custom server control <xx.Parent... /> which parses custom child controls <xx.Child... />. In Visual Studio 2008, IntelliSense shows me both when I start typing my control namespace. How can I prevent the child control from showing up in IntelliSense  unless I'm adding it within the parent tags?Thanks. --Rudy...

Usercontrol vs Custom Server Controls, Any need for Custom Server Controls
Hello I'm new to ASP.Net so this is probably a stupid question but, is there any need to create customer server controls now that you can pre-compile usercontrols into a dll and thus easily share between applications? This blog post from David Ebb describes how to do it and the restrictions he note don't seem that bad (other than being able to embed resources such as images in the dll). http://blogs.msdn.com/davidebb/archive/2005/10/30/487160.aspx His article desribes the techniques for ASP.Net 2.0 and he suggests that there will be further improvements in .Net 3.5 in this ar...

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

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

problems listenening to events on a custom server control from another custom server control
 Hi all,I am having problems listening to events on one of custom server controls(AddBookmark) from another custom server control(BookmarkList). The listener or the BookmarkList control has a property that can be set to the AddBookmark control (string at design but the reference is obtained at run-time). I am able to get a reference to the AddBookmark control and add a listener to it on the BookmarkList control on the OnPrender of BookmarkList. But the problem is that when the events on AddBookmark gets fired, the listener added from the BookmarkList is no longer present and the listene...

Custom Server Control Made of Custom Controls?
I'm giving myself a crash course in custom server controls, and I have a quick general question. Can I have a custom server control that is composed of other server controls I created. I'm pretty sure the answer is yes, but I want to be positive. Yes http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondevelopingcompositecontrols.asp Shows how to combine existing controls into a new control using class composition. -ron Thanks! ASP.NET so rocks! Making page components extensible objects is such a great idea! I love it....

How do you expose the event of a child server control from within a custom control?
I am trying to create a custom control that has a server control (dropdownlist) as a child.  I need to be able to expose the selectedindexchanged event from the dropdownlist at the page level.  How do you do this?  Here is a quick abbreviated example I wrote to show what I am trying to do:  My Custom Control1 Public Class MyCustomControl 2 Inherits Control 3 ' Variables 4 Protected WithEvents ddlServerControl As New DropDownList 5 ' Methods 6 Private Sub MyCustomControl_Load(ByVal sender As Object, ByVal e As System...

Server control not created child controls when hosted inside update panel
 Hi,  I am having a problem with the initialisation of a custom server control when it has controls inside an update panel, when its public properties are modified in the markup on the containing page. In the code below, you can see that: The server control contains a label, and exposes a public property, "Text", which simply wraps the text property of the label that it contains. The page contains a server control, and modifies the server control's "Text" property through the html markup. An "object is null" error occurs at line 7. The error can be fixed if eithe...

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

how to raise server control event(control defined inside user control) from host page?
I have built a user control(using c#,net 2.0,VS2005,MS-SQL server 2005),which contains set of 3 button,save,cancel and next and wud be reused/displayed in multiple pages.As the name says,they are suppose to update on save,reset the fields   on cancel and navigate to another page on next.How do i raise the onClick event for all of these button individually,from the individual host page?I do not have/do not prefer any logic,event handler etc.. defined in the user control for these buttons,since every host page have different set of parameters for save,cancel etc.Thanks...

Focus on Child control of Custom Control
hi, i am developing a custom control which consists of 1 textbox and 1 listbox.when textchange occuts it Binds data to the ListBox. My Problem is that how can I set the focus that is cursor position in the textbox as after Loading data in the ListBox textBox loses it's focus.   ................ Monir In the page load of webusercontrol set the focus to Textbox Code TextBox1.Focus() Hope this will help youAshok Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Res...

Custom Control with both properties and child controls
I'm trying to write a custom web control which would like like that: <test:MyControl runat="server" id="myControl">   <SomeProperties>       <Item1>Item1</Item1>       <Item2>Item2</Item2>   </SomeProperties>     <Contents>       <asp:ListBox ID="ListBox2" runat="server"></asp:ListBox>         <!-- other child controls -->    </Contents></test:MyCon...

Add child controls to a server control
Hi,How can I add child controls to a server control on the .aspx page WITHOUT adding a Template? I want something like this: (I only want to add controls of type "mystuff:MyOtherServerControl" as child control)<mystuff:MyServerControl ID="..." runat="..." ... >    <mystuff:MyOtherServerControl ID="..." runat="..." SomeProperties="..." />    <mystuff:MyOtherServerControl ID="..." runat="..." SomeProperties="..." />    <mystuff:MyOtherServerControl ID="..." runat="..." SomeProperties="..." />    <mystuff:MyO...

Web resources about - Custom Server Control With Child 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 ...

Victorian bushfires: Grassfire in Devon Meadows under control
... warnings as water bombers are called in to&nbsp;contain the blaze. A grassfire on the far outskirts of Melbourne has been brought under control ...

Gun control: Barack Obama plans to bypass senate, push through executive action on gun control
Barack Obama will meet with Attorney-General Loretta Lynch to discuss ways of reducing gun violence through measures that do not require congressional ...

Obama to Explore Bypassing Congress Gun Control - Al Jazeera America
'We know that we can't stop every act of violence,' Obama said Friday. 'But what if we tried to stop even one?'

Obama to impose gun control curbs
CBS News Obama to impose gun control curbs Ames Tribune HONOLULU — President Obama will press ahead with a set of executive actions on guns ...

Demographics Could Kill The GOP Off But Not In Congress, Not While Pelosi Controls The DCCC
... Democratic voters. In November 2014, Republican voters did just that with dramatic congressional victories that allowed the GOP to take control ...

Obama Holding Live Gun Control Town Hall On CNN This Week
Obama Holding Live Gun Control Town Hall On CNN This Week

Republicans fire back at Obama's gun control move
CBS News Republicans fire back at Obama's gun control move CBS News January 2, 2016, 6:31 PM - When President Obama returns from his Hawaiian ...

Obama plans to outflank hostile Congress with unilateral gun control moves
... from parents, and teachers, and kids, to sit around and do nothing&quot;. President Barack Obama, frustrated by Congress' inaction on gun control, ...

Trump blasts Obama's planned actions on gun control
CNN Trump blasts Obama's planned actions on gun control CNN Washington (CNN) Donald Trump is denouncing President Barack Obama's plan to expand ...

Resources last updated: 1/4/2016 1:57:51 AM