Help! Custom Server Control using User Control

I've been bashing my head for a few days on this problem. My Custom
Server Control loads the User Control and renders it properly.  But,
when I run the web application the controls (ex: buttons) from the User
Control is not firing the event (ex: a button click to change the
label's text)?

Here is a snippet of part of my code:
    Protected Overrides Sub CreateChildControls()
        plhPanel = New System.Web.UI.WebControls.PlaceHolder
        ContentFileLoaded = New System.Web.UI.UserControl

        For Each objPanel As jsPanel In aryPanels
            jsPanelId = "pid_" & Convert.ToString(objPanel.PanelId)
            jsContentId = jsPanelId & "_cid"

            If objPanel.ContentFile = Nothing Then
                plhPanel.Controls.Add(New LiteralControl(objPanel.Text))
                ContentFileLoaded = Me.Page.LoadControl(objPanel.ContentFile)
            End If
    End Sub

I'm guessing that maybe its not getting the controls from the User Control. Please Help Me!
1/4/2006 6:13:35 AM 3498 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 11
Get it on Google Play
Get it on Apple App Store

You must create the button click event for the custom server control.
Since the server control has been customized, you must declare and
define how the control would react when something is being clicked on
1/4/2006 9:59:59 AM
I don't know if I misunderstand your reply. I made my own control created from the "Web Control Library." My Custom Server Control receives the User Control file path (ex: content/page1.ascx) given from the Web Form (ex: default.aspx.vb). The Custom Server Control then renders the User Control. The problem is all the children controls in the User Control (ex: buttons, labels, textboxes) are not firing?
1/4/2006 4:25:42 PM

Similar Artilces:

Using a user control in a custom server control.
I've created a custom server control and am trying to add a user control to the rendering of the server control.  Is this possible?  If so, hints as to how this is done would be GREATLY appreciated!  Thanks in advance for considering an answer to this question. Wendi Use the LoadControl method. For example:   Controls.Add(LoadControl("~/controls/login.ascx"))Steven BeyRecursion: see Recursion My server control renders a table with x number of rows.  I want to add a user control to each row of the table, last column.  I do not know how ...

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

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 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. 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 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 sites and/or SharePoint sites why don't you just create Web Par...

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

Using a server control in the rendering a custom control
Hi. I have a custom control that overrides the Render method to draw itself.  Is it possible to use a server control (asp:Image, wwHoverPanel, etc.) inside such a custom control or would I have to rewrite my custom control as a composite control? I'd like to do something something like:protected override void Render(HtmlTextWriter w) { w.RenderBeginTag(HtmlTextWriterTag.Table); w.RenderBeginTag(HtmlTextWriterTag.Tr) w.RenderBeginTag(HtmlTextWriterTag.Td) // somehow place asp:Label here w.RenderEndTag(); // column w.RenderEndTag(); // row ...

load user control from server custom control
hi all,i have a 3rd party menu control that consists of a bunch of HyperLinks and a PlaceHolder control (C# v1.1.4) . links to .ascx files are retrieved from a data source, and when the page containing the control is loaded or a link clicked, the control uses this.Page.LoadControl(strLink) to add the .ascx to the PlaceHolder. fine and dandy, probably wouldnt have done it that way myself, but i'm stuck with it :)the problem is events: i can't raise 'em :( if i have for example a Button control on one of the .ascx pages, the Button.Click will go by unnoticed on the post-back. stran...

Using ajax control (CollapsiblePanelExtender) in custom server control
 Hi I'm trying to write a server control that contains the collapsiblePanelExtender from the ajax toolkit.  But I have the following error when i try to show this control: Extender control 'ctl00$contentHolder$ctl00$Ant_baseModule1_cpeDemo' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors(). I have no idea what i must add or change to make it working.  Anyone who has an idea?  Or maybe I'm doing it all wrong? This is my code:   Protected Overrides Sub Render(...

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

Can we use existing Server Controls to create Custom Controls?
Can we use the existing ASP.Net Server Controls to create Custom Controls? I am able to use HtmlTextWriter to make my Custom Controls. I want to be able to add regular ASP.Net server controls to create my Custom Controls. Is this possible? Can anyone provide a sample? Basically, you just need to inherit the control you want to use, like this: Public Class MyControl Inherits System.Web.UI.WebControls.TextBox Then you can override the methods you want and add code as needed. Peter BrunoneMS MVP, ASP.NETFounder, EasyListBox.comDo the impossible, and go home early. The str...

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

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

How do I use an embedded resource image in an imagebutton control in a custom server control?
I have a custom server control that I am building that includes an imagebutton control. I want to be able to use an image that I have included in the control as an embedded resource. Am I missing something here.... How do I get the imagecontrol to use the embedded resource image instead of the imageurl? Note : I'm still on 1. - not 2. yet....I build the the image control as follows.... Dim imgButton As New ImageButtonimgButton.ToolTip = Me.ToolTipimgButton.ImageUrl = ?????????AddHandler imgButton.Click, AddressOf imgButton_ClickControls.Add(imgButton)thanks I had the same question. Found ...

Web resources about - Help! Custom Server Control using User Control -

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

Grand Mufti of Australia in damage control after Paris attacks
AUSTRALIA’S top Muslim cleric has gone into damage control.

69 percent of users would bypass security controls to win a big deal
When faced with the chance of clinching a major deal people are willing to throw security controls out of the window. This is according to research ...

Obama to Veto Bill Requiring Background Checks On Syrian Refugees; France Demands Tighter Controls, EU ...
... does not call for ending the refugee program or require religious screenings, as some Republicans have demanded . France Demands Tighter Controls, ...

‘The Gun Control Song’ Channels Billy Joel To Troll Libs … Is Internet Gold
‘The Gun Control Song’ Channels Billy Joel To Troll Libs … Is Internet Gold

This App Lets You Control Your Smartphone By Drawing
Mouse gestures never made sense on PCs, but they're awesome on Android. Long before we started swiping and tapping on touch screens, mouse gestures ...

Mom And Dad Are Watching: 80% Of Parents Say It's OK To Secretly Put Control Apps On Kids' Phones
The biggest social media risks according to parents: Facebook and Snapchat. Men are more likely than women to trust children online.

Obama: I’m thinking I’ll spend my last year in office focused on gun control
Plans. Your alternate headline comes from Charles Cooke: “President Obama announces record gun sales in 2016.” So two of his major priorities ...

Islamophobic Media Coverage Is Out Of Control. It Needs To Stop.
Sometimes prejudice is subtle. On CNN Sunday, it was not. “ Why is it that no one within the Muslim community there in France knew what these ...

Resources last updated: 11/21/2015 11:18:18 AM