Mono Support Issue in adding a web part control dynamically 

Viewed 12358 time(s), 4 post(s), 4/15/2013 6:45:39 PM - by abhishekprasoon
4/15/2013 6:45:39 PM
25 Reputation 3 Total posts

Hi,

We are facing an issue in adding a web part control dynamically on wall page.
Whenever we try to add a control using WebPartZoneBase.Controls.Add(Control child)
method on a Monox:StyledButton’s Click event.Then it throws an exception “System.Web.HttpException:
MonoSoftware.MonoX.portalwebpartzonetableless does not allow child controls”.

Please help.

Rgds
Abhishek

1
4/15/2013 6:56:39 PM
3016 Reputation 428 Total posts

Hi,

the easiest way is to add a control directly to your markup page. But if you need to do it dynamically please add a placeholder to your markup and in code behind you can add a control dynamically to your placeholder.

Regards.

2
4/16/2013 11:23:48 AM
25 Reputation 3 Total posts

We have added a placeholder to your markup but it was not visible in code behind class.

We successfully added the MonoX Web part child controls on the wall page on a Monox:StyledButton’s Click event using GenericWebPart's CreateWebPart() method.

When 
this child control gets populated with list view having child controls further in each item of list view.

But this child control is disappearing on page post backs. 

We tried to maintain the view state of this child control but not able to do so.

 Please provide us the way to maintain the state of dynamically added controls on post backs.

3
4/16/2013 12:58:45 PM
526 Reputation 43 Total posts

Hi Abhishekprasoon,

data binding should be executed on init so the viewstate could load properly. At which stage did you do the binding? Or perhaps you could rebind the data on postback using isPostback() method?

4
This is a demo site for MonoX. Please visit Mono Software for more info.