MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Issue in adding a web part control dynamically  (Mono Support )

Viewed 5505 time(s), 4 post(s) 4/15/2013 6:45:39 PMby abhishekprasoon
abhishekprasoon

abhishekprasoon

4/15/2013 6:45:39 PM
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
This content has not been rated yet. 
25 Reputation 3 Total posts
imarusic

imarusic

4/15/2013 6:56:39 PM
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.
This content has not been rated yet. 
3016 Reputation 428 Total posts
abhishekprasoon

abhishekprasoon

4/16/2013 11:23:48 AM
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.
This content has not been rated yet. 
25 Reputation 3 Total posts
tihomir-kit

tihomir.kit

4/16/2013 12:58:45 PM
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?
This content has not been rated yet. 
526 Reputation 43 Total posts