Javascript 사용

Ajax Extension 2009. 4. 6. 15:18 posted by 무명시인


[msdn 참고 경로]

asp.net 에서 자바스크립트를 사용할때 다음메소드를 사용한다.


public static void RegisterClientScriptBlock(
    Control control,
    Type type,
    string key,
    string script,
    bool addScriptTags
)

public static void RegisterClientScriptBlock(
    Page page,
    Type type,
    string key,
    string script,
    bool addScriptTags
)


두개의 overload method..

다른건 실행 주체가 컨트롤(Update Panel 포함) 이냐..

Page 개체이냐의 차이다..

아래는 쌤플코드..


ScriptManager.RegisterClientScriptBlock(
            업데이트 패널 개체
            , this.GetType()
            , "jsAlert"
            , "<script type="text/javascript" language="javascript">alert('111');</script >"
	    , false);

ScriptManager.RegisterClientScriptBlock(            
	    this.Page            
	   , this.GetType()            
	   , "jsAlert"            
	   , "<script type="text/javascript" language="javascript">alert('111');</script >"
	   , false);