Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Adding DiagramView dynamically inside updatepanel (Read 2860 times)
deejoe
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jan 26th, 2010
Adding DiagramView dynamically inside updatepanel
Jan 26th, 2010 at 2:34pm
Print Post  
When you have an updatepanel and you place -for instance- a button into the updatepanel. You handle the button_Click event at server side. Inside this event handler add a DiagramView control (in imagemap mode) dynamically into the updatepanel. The DiagramView control will not be functioning correctly. You will get Error: 'document.getElementById(...)' is null or not an object

I think the Javascripts will not be registered correctly.

I have a small prototype to demonstrate this behavior. But, I don't know how to upload.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Adding DiagramView dynamically inside updatepa
Reply #1 - Jan 26th, 2010 at 6:32pm
Print Post  
Please email it to support@mindfusion.eu. For now you might try to load a hidden diagramview initially and when the button is clicked just make it visible.
  
Back to top
 
IP Logged
 
deejoe
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jan 26th, 2010
Re: Adding DiagramView dynamically inside updatepa
Reply #2 - Jan 29th, 2010 at 2:31pm
Print Post  
I have just sent you the demonstration of the issue as an attachemnt to your support email.

Anyway, thanks you for your suggestion, but unfortunately, we can't use it in the current project. It is a complex portal webapp and the sub pages are added dynamically in runtime. We can decide only in runtime which subpages are loaded and when. Only an updatepanel content is reloaded when a new subpage appears. We can't rally change it, since it would mean the change of the whole navigation engine. That would hurt Smiley
So, we are looking forward the solution. This seems to be the only problem with the product from our point of view, so it's a really good work!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Adding DiagramView dynamically inside updatepa
Reply #3 - Jan 29th, 2010 at 4:28pm
Print Post  
The problem happens because the control uses ClientScriptManager.RegisterHiddenField() to create a few hidden elements in the page DOM and post back through them various information about what happenned on the client side. Apparently the page content outside of the update panel cannot be modified from within the context of an UpatePanel asynchronous update, so the hidden elements do not exist on the page and you get the JS error. Now you can fix this by adding the fields to the update panel, e.g.

DiagramView1.ID = "dv";
HtmlInputHidden h1 = new HtmlInputHidden();
h1.ID = "_mfusion_dv_ClickedItem";
UpdatePanel1.ContentTemplateContainer.Controls.Add(h1);

However there's a bigger problem; the control calls Page.RegisterRequiresPostBack(this), which also does not work from within an update-panel event handler, and the posted-back diagram is lost. Our developer will research if there is some official way to register controls for post-back processing when added to the page in such a way.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint