Pergunta

i have one Webpart which shows an image slider. The image slider will be added by getting image url from webpart toolpart . and i will bind image slider in webpart using this.controls.add() method.

Here i need to allow users to add any webpart inside my webpart by creating a webpartzone. I think it is possible.

But the problem is everytime i'll create my control and webpartzone dynamically in creatchildcontrols() method. So if the user refresh the page the webparts inside the custom webpartzone 'll be deleted. Because i am building everying dynamically.

How to persist all the webparts and webpart proprties inside my custom WebPartZone, when the page refresh.

Please someone help me.

Foi útil?

Solução

Why do you need to add zone? You can simply use ImportWebPart and directly add the control to your controls collection.

Regarding persisting the settings, the parent web part will have to do that for the children. For this to work, you can implement an interface on your child webpart, which the parent can call to get the settings. The settings can be serialized by parent webpart and stored in its personalization database.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top