How to call window.alert(“message”); from C#?

后端 未结 10 2335
春和景丽
春和景丽 2021-02-07 05:18

I have my own exception based on some condition and want to raise an alert when control comes in this catch block

catch (ApplicationException ex)
{
    //want t         


        
10条回答
  •  情话喂你
    2021-02-07 05:49

    It's a bit hard to give a definitive answer without a bit more information, but one usual way is to register a startup script:

    try
    {
      ...
    }
    catch(ApplicationException ex){
      Page.ClientScript.RegisterStartupScript(this.GetType(),"ErrorAlert","alert('Some text here - maybe ex.Message');",true);
    }
    

提交回复
热议问题