The messagebox control cannot be used as an alert box in ASP.NET as it cannot be run from server side. Instead an “Alert” box provided by Javascript can be used in VB code by registering it with “Page.ClientScript.RegisterStartupScript”. Below is the code snippet for the same:
Dim strScript As String = "<script language='javascript'>alert('The enterd Student ID doesn't exist');</script>"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "callTest", strScript)
The above code will bring about alert box on page load. This is the whole purpose of using "RegisterStartupScript()". If an alert box has to be displayed when a button is clicked "RegisterClientScriptBlock()" can be used instead and the code should be inside the event's method.
More about this can be read at the following MSDN link:
http://msdn.microsoft.com/en-us/library/aa479390.aspx
Please remember to click Mark as Answer on the post that helps you.
iShare