質問

コードを使用して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

明らかにそれは正しい構文ではありませんが、これが私が求めていることを明確にすることを願っています。

役に立ちましたか?

解決

現在のページのマスターページ要素を通じて参照できる必要があります。次のようなもの:

ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("column1");

マスターページのコードビハインドにある場合は、名前で参照するだけです。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top