Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
JavaScript
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "clientscript", "alert('" + mystring+ "')", true);



I need to pop up not an alert box

What I have tried:

JavaScript
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "clientscript", "alert('" + mystring+ "')", true);
Posted
Updated 27-Jul-16 22:14pm
Comments
VICK 27-Jul-16 4:01am    
Do have a look at this link "http://stackoverflow.com/questions/25172311/display-bootstrap-modal-from-asp-net-webforms"
Karthik_Mahalingam 27-Jul-16 14:20pm    
you shall post this as answer..
perfect link for the question, i will upvote for sure.
VICK 28-Jul-16 4:14am    
Done. :)

RegisterClientScriptBlock just puts the code into the page but you then need to call it. Or, you can use ClientScriptManager.RegisterStartupScript Method (Type, String, String, Boolean) (System.Web.UI)[^] which will call it for you.

However, calling a popup from C# is a good indication that you may have a poor design so I would first have you reconsider what you are trying to do.
 
Share this answer
 
Added this before as a comment to help immediately to the OP and after the feedback from "Karthik Bangalore" posting it as a solution.

The given link provides a good detailed solution for the described problem.

Display Bootstrap Modal from Asp.Net Webforms


Hope it helps. :)
 
Share this answer
 
Comments
Karthik_Mahalingam 28-Jul-16 4:33am    
5! :)
Use following line:
Write in on click event of the button in codebehind
ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(Page), "message", "<script type=""text/javascript"" language=""javascript"">alert("" " + mystring + " "");</script>", False)
 
Share this answer
 
v2

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