Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem with load usercontrol dynamically !Problem with load usercontrol dynamically !
Previous
 
Next
New Post
12/26/2007 4:09 AM
 

- I have 2 modules, one is a menu module and one is a details module, each module is using Inter Module Communication. And when i click Product link on the menu module, the details module with show the Product.ascx without refesh the hole page (the ascx file is loaded in the codebehind). Everything are ok, and the problem is when i try to load a usercontrol which have:

<asp:UpdatePanel  ID="udpAdd" runat="server" UpdateMode="conditional">
<Triggers>
<asp:PostBackTrigger ControlID="btnUpdate" />
</Triggers>
<ContentTemplate>
....
<asp:Button ID="btnUpdate"...

Code behind :

Dim controlAdd As Control = LoadControl("~/DesktopModules/HeavenSpace/HeavenSpace.ascx")
controlAdd.ID = "AddNewDeceased"
udpAdd.ContentTemplateContainer.Controls.Clear()
udpAdd.ContentTemplateContainer.Controls.Add(controlAdd)

The error orccured:

A control with ID 'btnUpdate' could not be found for the trigger in UpdatePanel 'udpAdd'.

I have tried searching google all the times but no result !

Can anyone give me a solution for this case ? (sorry for my bad English)

Thank first !

 

 
New Post
12/30/2007 10:39 PM
 

- Really need help cuz i'm noob :(

 
New Post
12/31/2007 12:04 AM
 

The problem is that you're doing a Controls.Clear() which is removing the button you have on there. I would recommend removing the Clear() and see if that works for you. Another thing to do would be to add a PlaceHolder control in there as well, after the button, and instead of adding your control to the update panel add it to the placeholder instead.


Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
10/30/2008 11:56 AM
 

I'm in a similar boat - but can't claw my way out.

My module displays information - and then I dynamically add my own "Comments" control to the page.  The "Comments" control accepts comments and add teh comments to a repeater if the user is logged in - or sends the user an email if logged out.

This works fine!

But now I'm trying to implement templating ability and am losing everything on my postback.  When/If the template contains the token [COMMENTS] I run the follwing bit of code -- note - my ascx only has a PlaceHolder control on it named phListing:

Control d = LoadControl("Controls/Comments.ascx");
((Directory.Controls.Comments)d).name = listing.Name;
phListing.Controls.Add(d);

The comments control contains it's own button.  And when I click it - everything dis-appears - Because the page needs to be reloaded.  How can I persist it so my comments control will work?  I've tried placing an update panel INSIDE my comments module - but nothing seems to be happening when I click it.... and if I click it a second time - the page seems to "refresh" to nothing again.

I've also tried to add the above control code to another placeholder and add the placeholder to the phListing --- but that didn't work (and didn't seem to be the right thing to do).  I'm monkeyed with the Page_Init() but that gave me two sets of controls.

I'm more than a little confused, but am pretty sure it can be acomplished with a little bit more work... what am I missing?

Thanks All!



Andrew Walker

Learn to make your own beer and wine at homeIf you enjoy making your own beer and/or wine - be sure to check out http://www.ForemostBrewing.com
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem with load usercontrol dynamically !Problem with load usercontrol dynamically !


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out