过自定义页签动态添加一些内容,比如网页链接、图片等。
如果是动态的增加链接,可以参考一下代码,然后在ButtonClick事件里面对链接进行处理。
public override void AfterBindData(EventArgs e) { base.AfterBindData(e); List<PortalInforationContract> showInfos = GetInfo()//从数据库中读出要动态显示的内容; if (showInfos == null) { return; } int linkTop = 5; LayoutInfo layoutInfo = new LayoutInfo(); foreach (PortalInforationContract faq in showInfos) { LinkBtnAppearance newLink = new LinkBtnAppearance(); //新建链接 newLink.Key = faq.InfoID.ToString(); newLink.Caption = new LocaleValue(faq.Subject, this.Context.UserLocale.LCID); newLink.Container = "FPanel"; newLink.Top = new LocaleValue(linkTop.ToString(), this.Context.UserLocale.LCID); newLink.Left = new LocaleValue("20", this.Context.UserLocale.LCID); newLink.Width[this.Context.UserLocale.LCID] = "220"; layoutInfo.Add(newLink); linkTop += 20; } //得到要添加内容的面板 Panel p = this.View.GetControl<Panel>("FPanel"); //将动态内容逐条加到面板上 p.AddControls(layoutInfo); }