Run this code from any code behind event to invoke a alert/msgbox without having to use Page.RegisterStartupScript() or using an objects .Attributes property to tie an js alert to it.

This is independant from any object and just like having a VB6/VB.NET Messagebox.

VB Code:
  1. Protected Sub SomeSub(ByVal sender As Object, ByVal e As System.EventArgs)
  2.     Response.Write("<script language=javascript>alert('This is a dynamic alert.');</script>") '
  3. End Sub