5

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

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

4

1 に答える 1

6

現在のページのMasterPage要素を介して参照できるはずです。何かのようなもの:

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

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

于 2008-10-10T21:20:53.233 に答える