반응형
Page.RegisterStartupScript 를 사용하여 서버단에서 클라이언트단의 스크립트 블록을 내보내보자
서버단에서 다음과 같이 코드 작성 시
1 | Page.ClientScript.RegisterStartupScript(this, GetType(), "alert", "alert('테스트');", true); | cs |
클라이언트 단에서 봤을때 다음과 같다.
1 | <script>alert('테스트');</script> | cs |
[참고]
RegisterStartupScript는 body 상의 요소가 로드되기 전에 발생
RegisterClientScriptBlock은 body 상의 요소가 로드된 후에 발생
반응형
'프로그래밍 > .NET' 카테고리의 다른 글
[ASP.NET] DropDownList ListItem 선택 시 이벤트 발생 (0) | 2017.02.03 |
---|---|
[ASP.NET] CalendarExtender 텍스트박스 클릭 시 달력 노출 (0) | 2017.02.03 |
[ASP.NET] asp:Button OnClientClick 페이지 이동 오류 (0) | 2017.02.03 |
[ASP.NET] 리피터 컨트롤 사용 방법 (Repeater eval if condition) (0) | 2017.02.03 |
[ASP.NET] 잠재적 위험이 있는 Request.Form 값을 발견했습니다. (0) | 2017.02.03 |