WebPart Question

  • Thread starter Thread starter Parag C Mehta
  • Start date Start date
P

Parag C Mehta

Hi,

We are exploring the new possiblities in ASP.NET v2.0.

I want to have a page, in this page I have one WebPartManager
3 zones and I want to dynamically add WebParts to 3 zones.

I chose Page_InitComplete event (as explained in PDC 05) to load
UserControls dynamically into WebParts and Add it to Manager.

I just tried putting a Calendar Control on the UserControl and it
looses the values on postback :( . Change in dates doesn't work
(in fact control is as good as created a fresh).

How can I stop this behavious ???
 
I would step through the code and see where you are setting values. Most
likely that code is hit prior to your attempting to retrieve values. I have
seen this happen a lot in Page_Load, both in 1.x and 2.0.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***********************************************
Think Outside the Box!
***********************************************
 
Hi Gregory,

It's not Page_Load because I do in Page_InitComplete. In Pre_Init I enabled
the personalization on webPart.

Here is the basic synopsis :

=> Pre_Init of the Page enable personalization
=> Page_InitComplete : Load GenericWebParts dynamically from UserControl.

I tried putting it in Page_Init, but same result. And if I load control by
checking the postback,
then control disappears altogether! Which I assume is right. But what
perplexes me is that
user control values aren't serialized at all.

Best Regards,
Parag.


Cowboy (Gregory A. Beamer) said:
I would step through the code and see where you are setting values. Most
likely that code is hit prior to your attempting to retrieve values. I have
seen this happen a lot in Page_Load, both in 1.x and 2.0.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***********************************************
Think Outside the Box!
***********************************************
 
Back
Top