通过代码ASP.NET设置ContentPlaceHolder数据
是否可以通过代码设置ContentPlaceHolder中的数据? 这就是我的想法:
dim oCPH as new ContentPlaceHolder
oCPH.id = "column1" 'this id is the one that corresponds with the ID I set on the page
oCPH.content = "content here" '<-- not real code
显然这不是正确的语法,我希望这能澄清我的问题。
Is it possible to set the data in a ContentPlaceHolder through code? This is what I am thinking of:
dim oCPH as new ContentPlaceHolder
oCPH.id = "column1" 'this id is the one that corresponds with the ID I set on the page
oCPH.content = "content here" '<-- not real code
Obviously that is not correct syntax, I hope that this clarifies what I am asking.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够通过当前页面上的 MasterPage 元素引用它。 类似于:
如果在 MasterPage 代码隐藏中,只需按名称引用它。
You should be able to reference it through the MasterPage element on the current page. Something like:
If in the MasterPage codebehind, just reference it by name.