VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Msgbox function for ASP.Net Call this function from the server side, and a msgbox will appear on th

by Gath Adams (1 Submission)
Category: Internet/HTML
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Mon 21st November 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Msgbox function for ASP.Net Call this function from the server side, and a msgbox will appear on the client browser. As a bonus, the msgbox

Rate Msgbox function for ASP.Net Call this function from the server side, and a msgbox will appear on th




        Dim sb As New StringBuilder()
        Dim oFormObject As System.Web.UI.Control

        sMsg = sMsg.Replace("'", "\'")
        sMsg = sMsg.Replace(Chr(34), "\" & Chr(34))
        sMsg = sMsg.Replace(vbCrLf, "\n")
        sMsg = "<script language=javascript>alert(""" & sMsg & """)</script>"

        sb = New StringBuilder()
        sb.Append(sMsg)

        For Each oFormObject In Me.Controls
            If TypeOf oFormObject Is HtmlForm Then
                Exit For
            End If
        Next

' Add the javascript after the form object so that the 
' message doesn't appear on a blank screen.
        oFormObject.Controls.AddAt(oFormObject.Controls.Count, New LiteralControl(sb.ToString()))

end sub

Download this snippet    Add to My Saved Code

Msgbox function for ASP.Net Call this function from the server side, and a msgbox will appear on th Comments

No comments have been posted about Msgbox function for ASP.Net Call this function from the server side, and a msgbox will appear on th. Why not be the first to post a comment about Msgbox function for ASP.Net Call this function from the server side, and a msgbox will appear on th.

Post your comment

Subject:
Message:
0/1000 characters