Code Asp.net을 통해 Contentplaceholder 데이터를 설정하십시오
-
08-07-2019 - |
문제
코드를 통해 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
분명히 그것은 올바른 구문이 아니며, 이것이 내가 요구하는 것을 명확히하기를 바랍니다.
해결책
현재 페이지의 MasterPage 요소를 통해 참조 할 수 있어야합니다. 같은 것 :
ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("column1");
MasterPage CodeBehind에 있으면 이름으로 참조하십시오.
제휴하지 않습니다 StackOverflow