大家好, 我在母版页上有一个菜单控件.单击任何菜单项时,我正在将用户控件加载到母版页的内容页(Default.aspx)上. 我使用了更新面板和一个占位符,在其中加载了用户控件. 问题是,每当我加载用户控件时,整个页面都会回发,而不是更新面板中的部分. 我应该如何在每次单击菜单项时实现部分回发而不是整个页面回发. Default.aspx
< asp:UpdatePanel runat = " 服务器" ID = " pnlSecurityMain" > < contenttemplate> < asp:PlaceHolder runat = " 服务器" ID = " plcDynamic" > </ contenttemplate >代码隐藏
如果(!node.IsNull()) { UserControl uc =(UserControl)此 .LoadControl(node.UIControlId); uc.ID = " ucDynamicControl" ; plcDynamic.Controls.Add(uc); }在此先感谢 Amit
解决方案看看下面的链接. geekswithblogs/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx forums.asp/t/1085154.aspx 但是在用户控件中添加UpdatePanel并不容易. 将ASP.NET UpdatePanel控件与用户控件一起使用
Hi All, I have a menu control on master page. On clicking any of the menu items, I am loading a user control on content page(Default.aspx) of master page. I have used Update Panel and a Place holder inside on which i am loading the User Control. The issue is that whenever i load the User Control, Whole page postbacks instead of the part within Update Panel. How should i achieve partial postbacks on every menu item click instead of whole page postbacks. Default.aspx
<asp:UpdatePanel runat="server" ID="pnlSecurityMain"> <contenttemplate> <asp:PlaceHolder runat="server" ID="plcDynamic"> </contenttemplate>Codebehind
if (!node.IsNull()) { UserControl uc = (UserControl)this.LoadControl(node.UIControlId); uc.ID = "ucDynamicControl"; plcDynamic.Controls.Add(uc); }Thanks in Advance Amit
解决方案 Have a look at below links. geekswithblogs/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx forums.asp/t/1085154.aspx But is it not easier to have UpdatePanel in your User control. Using the ASP.NET UpdatePanel Control with User Controls更多推荐
在UpdatePanel中动态加载UserControl
发布评论