| Sign In/My Account | View Cart |
| Article: |
Enhancing ASP.NET Pages with JavaScript | |
| Subject: | How to use C# string variable in JavaScript | |
| Date: | 2006-10-06 00:01:51 | |
| From: | ManishKSingh | |
|
I want to pass a string variable and show it in a alert box but i am not able to get the value from the string variable which i m passing from C# code. Here is the function where i am doing the effort.Please suggests the solution.
|
||
Showing messages 1 through 1 of 1.
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