PDA

Click to See Complete Forum and Search --> : Message box in Asp.Net


hpl
Dec 4th, 2003, 10:46 AM
Is it possible to create a message box in ASP.Net in this code:


sub test()
dim tester as single
try
tester = Csng(txtBox1.text)
catch
((Show message box with text: "Please enter a number"))
end try


Maybe I forgot to make some Imports System.Web.?????

Memnoch1207
Dec 4th, 2003, 11:21 AM
messagebox in ASP.NET isn't possible, but you can create a javascript alert to run if a button is clicked.

Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
If (myExpression <> True) Then
Dim strScript As String = ""

strScript = "<script>"
strScript = strScript & "alert('You must select a file to upload');"
strScript = strScript & "</script>"

'Allows the alert box to be shown without wiping
'the controls off the page.
Page.RegisterStartupScript("ClientScript", strScript)
End If
End Sub