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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Dynamically Creating "TextEditor" and PortalSettings is nullDynamically Creating "TextEditor" and PortalSettings is null
Previous
 
Next
New Post
6/6/2008 10:39 AM
 

All,

 

I have a user control which is subsclassed from PortalModuleBase.

I have a "controls/TextEditor" control on the user control.

 

In my application, I am dynamically loading the UserControl and then getting the html markup of it. (I have to send this markup across the wire to another module)

 

WHile Loading, I get a NullPpointerException in RichTextEditor.Initialize(), Upon debugging I noticed that PortalSettings is null from ViewState.

The code to dynamically load control is

Page pageHolder = new Page();

UserControlBase viewControl = (UserControlBase)pageHolder.LoadControl(path);

pageHolder.Controls.Add(viewControl);

 StringWriter output = new StringWriter();
 HttpContext.Current.Server.Execute(pageHolder, output, false);

   return output.ToString();

 

If I remove texteditor from my control, everything works fine..Any DNN control is causing this error...

Now, if we have to load any control extending PortalModuleBase dynamically, do I have to do any thing for viewstate or somewhere?

 

Please any help is appreciated

 
New Post
6/6/2008 10:58 AM
 

ok..after further debugging, I found that, PortalSettings was null from Viewstate but then it loads from GetHostPortal() something like that

 

It appears the exception comes from FCKEditor initialize. here is the trace

System.NullReferenceException was unhandled by user code
  Message="Object reference not set to an instance of an object."
  Source="DotNetNuke.FckHtmlEditorProvider"
  StackTrace:
       at DotNetNuke.HtmlEditor.FckHtmlEditorProvider.FckHtmlEditorProvider.Initialize()   
       at DotNetNuke.UI.UserControls.TextEditor.Page_Init(Object sender, EventArgs e)
       in C:\projects\textSite\src\Library\Controls\TextEditor.vb:line 413   
       at System.Web.UI.Control.OnInit(EventArgs e)   
       at System.Web.UI.UserControl.OnInit(EventArgs e)   
       at System.Web.UI.Control.InitRecursive(Control namingContainer)   
       at System.Web.UI.Control.InitRecursive(Control namingContainer)   
       at System.Web.UI.Control.InitRecursive(Control namingContainer)   
       at System.Web.UI.Control.InitRecursive(Control namingContainer)   
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException:

 

Anyone please

 
New Post
6/6/2008 1:11 PM
 

ok..after further debugging I found that all ModuleConfiguration, PortalId, etc fields are null in the newly loaded control.

 

How do I load a user control such that it gets all these values set..my user control extends PortalModuleBase..but I am not loading this user control from a Class (which doesnt derive from PortalModulebase..Is this the issue??)

 

 

Can any one please explain me the basics of loading

 
New Post
6/6/2008 1:46 PM
 

That stuff is set through the ModuleConfiguration property, so you want something like viewControl.ModuleConfiguration = this.ModuleConfiguration;

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
6/7/2008 11:07 AM
 

Brian Dukes wrote

That stuff is set through the ModuleConfiguration property, so you want something like viewControl.ModuleConfiguration = this.ModuleConfiguration;

Hope it helps,

 

I thought of using that..but unfortunately it wouldnt work for me..

 

Because I am creating my "user control" in a web service (.asmx) which doesnt inherit from PortalModuleBase. 

For now, I removed RichTextEditor from my user control and directly outputting text to a Literal Control.

 

If you know a way to get PortalSettings or ModuleCOnfiguration from within a Class (that doesnt extend PortalModuleBase) please do let me know..That will help me to use all DNN Web Controls on my dynamic user control

 

TIA

 

 

 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Dynamically Creating "TextEditor" and PortalSettings is nullDynamically Creating "TextEditor" and PortalSettings is null


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