开发者

ASP.NET page won't remove UI elements

I'm working with an aspx page, where once I click on a button, some calls are executed in the background and I display the returned information on the webpage. I do this by adding this information to a panel:

panel.controls.add(label)
p开发者_高级运维anel.controls.add(anotherpanel)

Problem is that once I click the button again, and I get some new objects from the background calls the UI elements (those labels and panels) still remain visible and my new information is just added after the previous one.

I would like to have all the previous information gone once I press the new button.

I've tried panel.controls.clear(), but it doesn't do anything.

Any ideas? Thanks.


Have you tried setting a breakpoint and check to see that it is not the background calls returning the previous information along with the new ones?

I asked because items that were added programmatically, by itself, shouldn't persist across postbacks.


You might want to declare label and anotherpanel in the actual markup, and set their visibility to false. Then, just set the visibility to true and replace their values in your codebehind as you acquire results.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜