vb.net clearing panel contents inside update panel before postback
I have a basic update panel which contains a panel inside. This inner panel dynamically creates controls based on a dropdown value.
The problem I am having is when I change the dropdown item and it updates the updatepanel, I开发者_JAVA技巧 want to clear the contents of the inner panel before calling the function that populates the controls.
Panel code:
<asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger controlid="Dropdownlist1" eventname="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="custompanel" runat="server">
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
I have a function populatecustompane() that populates the panel.
I can get the new controls to show the 1st time i change the dropdown, but the old controls dont get removed
Call custompanel.Controls.Clear
before adding the new controls.
精彩评论