在更新面板中添加动态控件然后无法加载viewstate错误?

时间:2009-12-07 09:00:25

标签: asp.net asp.net-ajax

在更新面板中添加动态控件然后无法加载视图错误?

参见以下示例: -

UpdatePanel面板= new UpdatePanel();

panel.ContentTemplateContainer.Controls.Clear();             if(strPopupType ==“O”)             {                 Control ctrl = Page.LoadControl(@“〜/ Modules / MLM / UnilevelViewer / DesktopModules / OrderDetails.ascx”);

            OrderDetails orderdetails = (OrderDetails)ctrl;
            orderdetails.ID = "Orders" + elementID;
            orderdetails.OrderID = Convert.ToInt32(elementID);
            //orderdetails.ModuleSkinStyleName = CurrentModuleSkin;
            panel.ContentTemplateContainer.Controls.Add(ctrl);
        }
        else if (strPopupType == "U")
        {
            Control ctrl = Page.LoadControl(@"~/Modules/MLM/UnilevelViewer/DesktopModules/UserDetails.ascx");

            UserDetails userdetails = (UserDetails)ctrl;
            userdetails.ID = "Users" + elementID;
            // userdetails.UserModuleSkinStyleName = CurrentModuleSkin;
            userdetails.UserID = new Guid(elementID);

            panel.ContentTemplateContainer.Controls.Add(ctrl);
        } 

1 个答案:

答案 0 :(得分:0)

Hai Tushar,    看看这个Viewstate of a dynamically generated control