[C#,ASP.NET] 메시지박스(MessageBox) 띄우기,대체로 자바스크립트를 사용하면 된다.
꽁스짱
ASP.NET
0
1391
2021.02.17 02:06
[C#,ASP.NET] 메시지박스(MessageBox) 띄우기,대체로 자바스크립트를 사용하면 된다.
아래 예문을 참고하자~
<asp:Button runat="server" OnClientClick="alert('클릭!');" />
<asp:Button runat="server" OnClientClick="return confirm('진짜?');" />
protected void Page_Load(Object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language='javascript' type='text/javascript'>alert('클릭');</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
}
=============================================================
Response.Write("<script type='text/javascript'>alert('t is null')</script>");
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language='javascript' type='text/javascript'>alert('t 는 널 입니다.');</script>");
ClientScript.RegisterStartupScript(this.GetType(), "alert", sb.ToString());
ClientScript.RegisterClientScriptBlock(typeof(string), "confirm", sb.ToString());