What is the easiest way to set the contents of an <asp:ContentPlaceHolder>
programmatically? I imagine ill have to do a Master.FindControl
call?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
I use a custom extension method that searches a control (a placeholder for example) recursively to find the control you're looking for by Id and return it. You can then populate the returned control as required. Call this in a foreach loop iterating over your list of controls to populate.
If your page inherits from a MasterPage, then you should have an asp:Content control on your page with some id, like so:
You should be able to reference this in your codebehind and add whatever you want to it.
If you are adding controls to a blank page then you do Page.Controls.Add()....no?