本文介绍了添加占位符动态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚如何动态地添加一个占位符。这里是code我使用。它不承认的占位符。

I cannot figure out how to add a placeholder dynamically. Here is the code I am using. It does not recognize the placeholder.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Not Page.IsPostBack Then

       Dim Chart As New Chart
       Chart.ID = "Chart" & MyTerrCode

       Dim Placeholder As New PlaceHolder
       Placeholder.ID = "Placeholder" & MyTerrCode

       PlaceHolder.Controls.Add(Chart)
       PlaceHolder.Controls.Add(New LiteralControl("<br><br>"))

    End If

End Sub

下面是我错过了。我需要的占位符添加到页面。
     this.Form.Controls.Add(预留)

Here is what I missed. I need to add the placeholder to the the page. this.Form.Controls.Add(PlaceHolder)

推荐答案

下面是我错过了。我需要的占位符添加到页面。否则占位符永远不会说。

Here is what I missed. I need to add the placeholder to the the page. Otherwise the placeholder never gets added.

this.Form.Controls.Add(预留)

this.Form.Controls.Add(PlaceHolder)

这篇关于添加占位符动态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 08:43