ASP.NET(vb.net) & Msgbox How to test Msgbox,Messagebox (alert message) in a ASP.NET script.
ShotDev Focus:
- Messagebox in ASP.NET
Example
MsgBox.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MsgBox.aspx.vb" Inherits="MsgBox" %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <asp:TextBox id="txtName" runat="server"></asp:TextBox> <asp:Button id="btnSubmit" runat="server" Text="Submit" /> </form> </body> </html>
MsgBox.aspx.vb
Public Class MsgBox Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack() Then Page.RegisterClientScriptBlock("OnLoad", "<script>alert('Welcome to ShotDev.Com')</script>") End IF End Sub Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Page.RegisterClientScriptBlock("OnLoad", "<script>alert('Sawatdee " & Me.txtName.Text & "')</script>") End Sub End Class
Screenshot