我有一个面板,我试图从后面的代码中添加一个用户控件。问题是一旦代码运行,加载的控件就不会出现在面板中。我错过了什么吗?
<div id="ShippingDetails" runat="server" visible="true">
<asp:Panel ID="Panel1" runat="server"></asp:Panel>
</div>
</form>
</asp:Content>
后面的代码:
protected void Page_PreRender(object sender, EventArgs e)
{
if (OrderSearch1.SelectedValues != null)
{
InitializeShippingDetailControls();
}
}
public void InitializeShippingDetailControls()
{
admin_InputControl control = new admin_InputControl();
control.InitializeInputControl(ShippingDetailInputControls, new DataModels.EDIOrderShipmentInfo(), 1, "Shipment Details");
Panel1.Controls.Add(control);
}