Possible error in ASP.NET UpdatePanel?

I came across what seems like an annoying bug with asp.net UpdatePanels in two separate projects. If you have some kind of auto-repeat control that can cause all the controls in the update panel to have visible = false set, which will lead to an empty update panel.

When the AutoPostBack control changes back to the postion, which allows all the controls in the update panel again, it simply does not make a call back to the server and the panel update is not updated.

If you do anything else that makes a callback on the same page, the contents of the update panel appear. It is as if asp.net decided the update panel is empty, so there is no point in maikng a callback, even if you make a call back it will populate the UpdatePanel with the content.

The only way around this is to add a display:none style to the controls instead of setting the visible=false property.
Then it works great.

Has anyone else encountered this problem? Is this a mistake, as I suspect, or is it likely I am doing everything wrong? I don’t have time to place the sample code at the moment as a code, I use too wrapped up in other unrealted things, if people think that this will help, I will create a simple example and post it when I get the time.

+4
source share
3 answers

Place the control that runs asyncpostback inside the patch panel for this hotfix. I would definitely say that this is a mistake, because the only difference is that it works when the control is inside the update panel and not when it is outside the update panel.

+1
source

The AutoPostBack = "true" control must be set to AsyncPostBackTrigger in the UpdatePanel.

+1
source

I had the same problem. I have an update panel and dropdownlists with enable = false. When the user has made AsyncPostBack in the UpdatePanel, the popup windows outside the UpdatePanel will become enable = true witout to execute any code. When I add these dropdowns to UpdatePanel - everything works. I do not know why.

0
source

Source: https://habr.com/ru/post/1307538/


All Articles