0
I am developing a web system on Asp.net and came across a problem.
On the return of your Catchs, I return an error through an Alert to the user thus:
try{
...
}
catch(Exception ex){
Response.Write("<script>alert('Erro ao adicionar valores no banco.');</script>");
}
The problem is that I also use a class. Cs that is not related to any page, and it also needs to return some errors, but if I use "Response.Write" nothing happens.
How could I return these errors in the browser?
I have tried the following ways, but have not succeeded:
Response.write
page.ClientScript.RegisterClientScriptBlock()
ScriptManager.RegisterStartupScript()
How are you making use of the
ScriptManager.RegisterStartupScript()
?– JcSaint
I used it like this: Scriptmanager.Registerstartupscript(this,Gettype(),"showalert","Alert('Only Alert Message');",true); as stated on this link: http://stackoverflow.com/questions/5825165/javascript-alert-showmessagefrom-asp-net-code-behind
– Csorgo