MsgBox From ASP


This article is written by Pon Saravanan  on 21-Jul-07 Last modified on :06-May-13





MsgBox From ASP

To show message box from asp.net applications is not as easy as we do in Visual Basic for win forms. We have to do it in client scripting so we are using javascript to create an alert. We are using the same naming as we do in classic visual basic. the code is below.

We can do the same in the client scripting directly in the markup. But several times in an application we may need to handle this in a code behind so it is always useful to have a helper method in the serverside to show alerts

Source Code

<%
Sub MsgBox(strMsg )
 Dim strScript
        strScript = "<script language='Javascript'>"
        strScript &= "self.alert('" & strMsg & "')"
        strScript &= "</script>"
        Response.Write(strScript)
End Sub
%>



- Next »







Comments
  • GUEST
    Thanks. This is very good presentation. I'm trying to adopt this tutorial to formview but i can't achieve so far. Could you convert this tutorial for the formview.
    Thanks
    2/27/2010 11:00:11 AM


Comments
   
Captcha Image
For you specially:  
Captcha Text Enter the text in the image.(Not Case sensitive)    



Spam Bot Trap



   



Select Theme
White
Blue
Brown
Gray