Saturday, March 24, 2012

Panel disappear after manually update

Hi,

Here is my scenerio

<updatepanel1>

<div>

..............

</div>

<mainPanel1>

<updatepanel2>

<panel visible='true'>

<linkbutton id='lbtnSetVisibleUpdatePanel3' />

</panel>

</updatepanel2>

<updatepanel3>

<linkbutton id='lbtnSetVisibleUpdatePanel2' />

</updatepanel3>

<button id='setVisibleMainPanel2' />

</mainPanel1>

<mainPanel2 visible='false'>

<button id='setVisibleMainPanel1' />

</mainPanel2>

</updatePanel1>

When the page first loaded, mainPanel1 & updatePanel2 is visible. mainPanel2 & updatePanel3 is invisible. When I click on the button setVisibleUpdatePanel3, updatePanel3 will be set to visible and updatePanel2 will be set to invisible. It works fine. When I click on setVisibleMainPanel2 which will set visible mainPanel 2, and invisible mainPanel1, it works fine as well. The problem is when I click on button setVisibleMainPanel1 again which will set mainPanel1 visible again, and invisible mainPanel2, the updatePanel3 turn to nothing when I click on setVisiblePanel3. However, updatePanel2 is still there. Is is a problem related to nested update panel? Does anyone have this problem before?

Many thanks!


Have you got any solution ?

If yes please post it...


Hello,

I found that the updatepanel visible property is useless (in complex scenarios) so I have the same experience than yours.

/ Maybe the up visible property should works, only we've made mistakes. I don't know. /

However the solution is easy for me:

- never use the updatepanel visible property

- put a placeholder or a panel control inside each up, and use that control's visible property. Much cleaner and easier to follow what happens when you toggle the placeholders visible property.


Sorry, I am still trying to solve it. Does anyone have the solution?



testerASPNet:

The problem is when I click on button setVisibleMainPanel1 again which will set mainPanel1 visible again, and invisible mainPanel2, the updatePanel3 turn to nothing when I click on setVisiblePanel3. However, updatePanel2 is still there

Normally when you click lbtnSetVisibleUpdatePanel3 (which set visible=true/false on updatepanel3) it will update updatepanel2 only, updatepanel3 won't rendered until something trigger an updatepanel1 refresh.

I think what you really need in lbtnSetVisibleUpdatePanel3 click event in the code behind:

updatepanel3.visible = true/false;

updatepanel1.update( ); // if that missing only updatepanel2 will be updated during the partial postback.

No comments:

Post a Comment