Click here to Skip to main content
15,900,108 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hmm..

Javascript alert instead of Response.Write method is all I need. Any Ideas...
Posted
Updated 24-Aug-11 7:29am
v2
Comments
[no name] 24-Aug-11 13:09pm    
One idea comes to mind. Rephrase this to be an actual question that can be answered.

I guess you are trying to show any message on button click using JavaScript,if yes then try this :

C#
protected void Button1_Click(object sender, EventArgs e)
    {

        string script = "<script type=\"text/javascript\">alert('Your message!');</script>";
       Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", script);

    }

hope it helps :)

for further queries comment here!!
 
Share this answer
 
v2
Comments
the headless nick 24-Aug-11 15:07pm    
Cool :))
Found It :))

C#
Response.Write(@"<script language='javascript'>alert('The following errors have occurred: \n" + Err() + " .');</script>");
 
Share this answer
 
Comments
Manfred Rudolf Bihy 24-Aug-11 13:23pm    
Examining your "solution" closely I'm wondering about the "instead of Response.Write" part you mentioned. I can see the "Response.Write" part quite clearly in your "solution" so you should try to explain what you were trying to do in the first place.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900