Dynamic use of User control within custom control

Dynamic use of User control within custom control

Post by UmljaE » Thu, 25 Sep 2008 19:56:01


[Firstly apologies this is a repeat post as my original post was not answered]

I am trying to create a project using the ASP.NET AJAX accordion control. I
would like to dynamically add panes to the control with a form template added
when the pane is added. I have tried unsuccessfully in creating the whole
pane as a user control and have succeeded in adding the pane and then
dynamically adding the content which is a user control.

However I would like to have a single pane control which I can add which
includes the header and content. I therefore was trying to find a way to
create a custom control derived from Pane which has the User control as the
content. I cannot however find a way to add the user control to the custom
control. Is this possible to do, or do I need to just create the content from
the standard controls rather than as a user control?

Thanks,
Richard
 
 
 

1. nUnitASP: HowTo reference ASP.NET UI controls within custom User Control?

2. using javascript in User controls to access server controls of the user control

Hello all,
I have an asp.net textbox (named txtHidden) and an HtmlButton(named
btnAction). I wanted to write a javascript function which will get called
when the btnAction is clicked. The function is as follows

function HideText()
{
document.all.item("txtHidden").style.visibility = "hidden";
}

This function works fine when i run it in an asp.net page.
The problem is that it doesn't work inside a user control. i.e. lets say i
place the two controls and the javascript to work on them, in a user
control(say MyUC), then the statement document.all.item("txtHidden") does
not return anything.

After a bit of effort i've been able to identify that when a user control is
placed on a page, asp.net, while rendering the page appends all the child
control of a user control with the client id of the user control to avoid
naming conflicts. So after the page is rendered the id of "txtHidden" is
changed to "myUC1_txtHidden".
Since at the design time of UC we dont know the ClientID of the user
controls, therefore this makes it impossble to write javascripts in a user
control, which is exactly what i want to do.

Any help will be highly appreciated.

Regards
Faizan Ahmed

3. Dynamic Controls in User Control; page/control lifecycle question

4. ASP.NET Templated User Controls - Limit child controls allowable within a templated control

5. Using a custom server control declaratively in a user control

6. Custom User Control is not rendered inside another user control in a server table.

7. Custom User Control is not rendered inside another user control in

8. Dynamic controls within the days of a calendar control

9. using controls in user control as control parameters on parent pag

10. using controls in user control as control parameters on parent page

11. using controls in user control as control parameters on parent

12. Exposing contained control properties from within a custom control

13. IDENTIFYING CHECKBOXLIST CONTROL within CUSTOM PLACEHOLDER CONTROL

14. Controls within Custom Control Don't Render

15. How to address control within templated custom control from code behind