Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AspDotNetStoreFront
  Ads  
Active Modules -- Active Forums for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

CrystalTech Web Hosting™
Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  ClientAPI Compo...  How to add AJAX controls dynamically
Previous Previous
 
Next Next
New Post 6/9/2008 9:40 PM
User is offline Rodney Joyce (Can't Post with old Account)
52 posts
10th Ranked


How to add AJAX controls dynamically 

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 8:40 PM
User is offline Jon Henning
1622 posts
www.codeendeavors.com
5th Ranked










Re: How to add AJAX controls dynamically 

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


 
New Post 6/10/2008 10:31 PM
User is offline Rodney Joyce
1640 posts
www.smart-thinker.com
5th Ranked




Re: How to add AJAX controls dynamically 
Modified By Rodney Joyce  on 6/11/2008 12:33:16 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);
        }


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/11/2008 6:40 AM
User is offline Jon Henning
1622 posts
www.codeendeavors.com
5th Ranked










Re: How to add AJAX controls dynamically 

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 5:25 PM
User is offline Rodney Joyce
1640 posts
www.smart-thinker.com
5th Ranked




Re: How to add AJAX controls dynamically 

 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!


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!
 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  ClientAPI Compo...  How to add AJAX controls dynamically
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Bring2mind
Document Centric DNN Module Solutions
www.bring2mind.net
WEBPC™ DotNetNuke® sites for Small Business
WEBPC™ are internet consultants and web hosters catering to the small business market.
www.webpc.biz
Perpetual Motion Interactive Systems Inc.
A solutions company specializing in Microsoft enterprise technologies.
www.perpetualmotion.ca

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP