프로그래밍/.NET
[ASP.NET] Page.RegisterStartupScript 클라이언트 쪽 스크립트 블록 사용
초보개발자꽁쥐
2017. 2. 3. 10:22
반응형
Page.RegisterStartupScript 를 사용하여 서버단에서 클라이언트단의 스크립트 블록을 내보내보자
서버단에서 다음과 같이 코드 작성 시
1 | Page.ClientScript.RegisterStartupScript(this, GetType(), "alert", "alert('테스트');", true); | cs |
클라이언트 단에서 봤을때 다음과 같다.
1 | <script>alert('테스트');</script> | cs |
[참고]
RegisterStartupScript는 body 상의 요소가 로드되기 전에 발생
RegisterClientScriptBlock은 body 상의 요소가 로드된 후에 발생
반응형