Domanda

È possibile impostare i dati in un ContentPlaceHolder tramite il codice? Questo è ciò a cui sto pensando:

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

Ovviamente questa non è sintassi corretta, spero che questo chiarisca ciò che sto chiedendo.

È stato utile?

Soluzione

Dovresti essere in grado di fare riferimento ad esso tramite l'elemento Pagina master nella pagina corrente. Qualcosa del tipo:

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

Se nel codice della Master Page dietro, fai semplicemente riferimento per nome.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top