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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesusing Find Control in DotNetNukeusing Find Control in DotNetNuke
Previous
 
Next
New Post
9/20/2011 12:01 PM
 
Hi,I have a table that is created in code behind that lists a bunch of data. I am trying to make it so I can export it to Excel, so I need to be able to find the control using Page.FindControl.The only problem is I cannot figure out how to get through all the controls it is nested in. Is there any way I can find every single control on the page, if they are nested or not, or some other way to get through all of the DNN controls and find my control on the page?Thanks for your helpChris
 
New Post
9/20/2011 8:03 PM
 

The DotNetNuke API provides the FindControlRecursiveDown method to do just that - it is located in the namespace DotNetNuke.Common.Globals:

In C# (DNN 6.x)

public static Control FindControlRecursiveDown(Control objParent, string strControlName) 

In VB (DNN 5.x)

Public Shared Function FindControlRecursiveDown(ByVal objParent As Control, ByVal strControlName As String) As Control

Note that since this can be an "expensive" operation, it is best not to use Page as the parent control but rather pass in a parent control as close as possible to the desired control in the nesting hierarchy.



Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
9/21/2011 11:55 AM
 
Hi William,Thanks for the information. I tried it out and it is grabbing a RadioButtonList as the control, instead of the table.One thing is that my table (the item I am trying to locate) is created in the code behind and the printed to the page with InnerHtml. So the table is set up like this stuff in here
Am I still able to use FindControlRecursiveDown as it is asking for the ControlName?I was going with: DotNetNuke.Common.Globals.FindControlRecursiveDown(Page, "MyTable")Chris
 
New Post
4/18/2013 7:12 AM
 
Hi
I used the FindControlRecursiveDown() and able to grab the Radiobutton list which i created dynamically. Now when i am trying to get the selected value from the RBL using the SelectedValue property, i am unable to do that.
Is there any way or am i missing some thing?

Thanks,
Sunil Kumar [ DNN Developer, Mindfire Solutions,India ]
 
New Post
4/22/2013 2:27 AM
 
Just for information, using FindControlRecursiveDown(Page, "RBL") will not return the accurate instance of radio button list. Use this instead of Page for accuracy.

Thanks,
Sunil Kumar [ DNN Developer, Mindfire Solutions,India ]
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesusing Find Control in DotNetNukeusing Find Control in DotNetNuke


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