Women in Technology

Hear us Roar



Article:
  Enhancing ASP.NET Pages with JavaScript
Subject:   How to use C# string variable in JavaScript
Date:   2006-10-22 01:54:53
From:   ashraf_gawdat
Response to: How to use C# string variable in JavaScript

This must be working



private void PopUpMessege(string msg)
{
string popupScript = "<script language='javascript'>" +
"window.alert("+msg+");</script>";
Page.RegisterStartupScript("PopupScript", popupScript);
}



So you must add the variable (msg) as a variable not as a part of the string