And it is not working. Again, I have to stress that the reason why it does not work is because I'm using AJAX UpdatePanel. If I turned off the AJAX UpdatePanel then it works perfectly. So unless there is a trick going around this AJAX UpdatePanel issue,
it's not going to work.
the following code work fine in c# under code behind with @ symbol in proper place
"<script language='javascript'>alert('The following errors have occurred: \n" + strErrorDesc +
" .');</script>");
MY ISSUE IS I NEED A NEW LINE AFTER strErrorDesc for that i used a modified code like this
Response.Write(@"<script language='javascript'>alert('RESETTER PFNO: \n" + Session["usrid"].ToString() + " \n BELONGS TO AN OFFICER OF CPPC');</script>");
BUT IT DIDN'T WORKED AT ALL
SO COULD YOU PLEASE GUIDE ME TO SOLVE THIS SITUATION
mychucky
Contributor
4358 Points
3709 Posts
Re: Response.Write Alert box in C#
Jun 05, 2007 01:22 PM|LINK
I already tried this:
ClientScriptManager csm = Page.ClientScript; if(!csm.IsStartupScriptRegistered(this.GetType(), "winPop")) { csm.RegisterStartupScript(this.GetType(), "winPop", "alert('Update is successful');", true); }And it is not working. Again, I have to stress that the reason why it does not work is because I'm using AJAX UpdatePanel. If I turned off the AJAX UpdatePanel then it works perfectly. So unless there is a trick going around this AJAX UpdatePanel issue, it's not going to work.
rareair
Member
2 Points
1 Post
Re: Response.Write Alert box in C#
Nov 09, 2007 06:15 PM|LINK
Did you figure out a solution to this problem? I have exactly the same issue.....trying to figure out how to fire an alert while using AJAX
michael.hool...
Member
4 Points
2 Posts
Re: Response.Write Alert box in C#
Feb 18, 2009 12:35 AM|LINK
hi,
old thread but i thought i'd post...might help somebody out...
for ajax, you need to use the scriptmanager's built in method: RegisterClientScriptBlock
eg. ScriptManager.RegisterClientScriptBlock(UpdatePanelControlName, typeof(UpdatePanel), "somerandomstring", "alert('yo');", true);
good luck...
mick.
mujisbbj
Member
2 Points
1 Post
Re: Response.Write Alert box in C#
May 29, 2009 08:21 AM|LINK
the following code work fine in c# under code behind with @ symbol in proper place
"<script language='javascript'>alert('The following errors have occurred: \n" + strErrorDesc + " .');</script>");
MY ISSUE IS I NEED A NEW LINE AFTER strErrorDesc for that i used a modified code like this
Response.Write(@"<script language='javascript'>alert('RESETTER PFNO: \n" + Session["usrid"].ToString() + " \n BELONGS TO AN OFFICER OF CPPC');</script>");
BUT IT DIDN'T WORKED AT ALL
SO COULD YOU PLEASE GUIDE ME TO SOLVE THIS SITUATION
output i require is
RESETTER PFNO:
20154
BELONGS TO AN OFFICER OF CPPC
noobie
Member
83 Points
31 Posts
Re: Response.Write Alert box in C#
May 30, 2009 05:13 AM|LINK
Hello try this one.
alert('First Line\\nSecond Line') ;
hope this helps!
thanks!
flohaas
Member
733 Points
212 Posts
Re: Response.Write Alert box in C#
May 30, 2009 05:35 AM|LINK
it is working.......
Response.Write(@"<script language='javascript'>alert('RESETTER PFNO: \\n" + strErrorDesc + " \\n BELONGS TO AN OFFICER OF CPPC');</script>");
my articles
Florence
My Blog