Thursday, 1 October 2015

Javascript - how to fix error - Expected hexadecimal digit

Watch this exmaple on YouTube:
Replace:
    Private Sub dispMessage(ByVal message As String)
        Try
            Dim myScript As String = String.Format("<script> alert('{0}');</script>", message)
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "script", myScript)
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
   
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        dispMessage("Record has been saved\updated.")
    End Sub

With:

    Private Sub dispMessage(ByVal message As String)
        Try
            Dim myScript As String = String.Format("<script> alert('{0}');</script>", message)
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "script", myScript)
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
   
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        dispMessage("Record has been saved-updated.")
    End Sub

\u - is causing this error

No comments:

Post a Comment