Nazwa „ClientScript” nie istnieje w bieżącym kontekście
Mam javascript za kodem. to jest pokazanie okna dialogowego javascript.
jednak zachowaj ten błąd
The name 'ClientScript' does not exist in the current context
Ten kod został umieszczony w masterpage. Użyłem też dokładnie tego samego kodu w innym pliku aspx, a poza tym działa to dobrze ...
oto mój kod:
protected void Button2_Click(object sender, EventArgs e)
{
string message = "Order Placed Successfully.";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); string script = "alert('abc');";
}