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

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIHow to add AJAX controls dynamicallyHow to add AJAX controls dynamically
Previous
 
Next
New Post
6/9/2008 11:40 PM
 

Hi,

I added the EditLabel control via the normal means and it works great. I then need to add it dynamically (I am using it in my templating solution). Other controls work (including buttons with postbacks). Here is my code:

In OnInit:

                DNNLabelEdit status1 = new DNNLabelEdit();

                status1.Text = "bbbbbbbbbb";
                status1.EditEnabled = true;

                phUserProfile.Controls.Add(status1);

 

Is there anything fancy I should know about dynamically adding AJAX controls? It shows up but does not go into Edit mode. Or am I possibly just missing a property?


Thanks,
Rodney
Smart-Thinker - Social Networking modules for DotNetNuke
The DotNetNuke Directory - Are you listed?
PokerDIY - Example Implementation of DNN Social Network
Do use DNN a lot? Try the DotNetNuke Toolbar to save you time!
 
New Post
6/10/2008 10:40 PM
 

Let me suggest looking at the webcontrols samples.    Specifically then Webcontrols in Templates sample.


 
New Post
6/11/2008 12:31 AM
 

Thanks Jon, I tried setting that property (CallbackType=ProcessPage) on my dynamically-loaded control, but this didn't work. Do any of these downloads contain these samples? I would like to see the code for his example, although I suspect the control has been declared within the control on the .ascx page and not created dynamically?

 

My new code is:

protected void Page_Init(object sender, System.EventArgs e)
        {
                DNNLabelEdit status1 = new DNNLabelEdit();

                status1.Text = "Dynamically Generated Control";
                status1.EditEnabled = true;

                status1.CallBackType = ClientAPICallBackResponse.CallBackTypeCode.ProcessPage;
                phUserProfile.Controls.Add(status1);
        }


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
6/11/2008 8:40 AM
 

Yes, the top link Titles Webcontrols contains a link to the downloading of the source, which contains the sample website.

You are correct, that the samples do declare the controls in markup.  The sample I pointed to shows you how to use the control in a template, which deals with the problem of the control not existing during a callback.  This is what the CallBackType property allows you to do, sync a late rendered control.

In your case however, I think all your missing is the assignment of an ID for your control.


 
New Post
6/11/2008 7:25 PM
 

Jon Henning wrote

In your case however, I think all your missing is the assignment of an ID for your control.

Ah - I see - thanks Jon, that did the trick - very impressive stuff!


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIHow to add AJAX controls dynamicallyHow to add AJAX controls 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