Response.Write alert?

JohnShell

Member
Joined
Sep 6, 2009
Messages
9
Programming Experience
3-5
Hi,

On web page of ASP.NET using VB.NET for code behind. Want to provide JavaScript alert when database update succeeds or fails. Prefer not to open new window but to have only alert dialog box appear. Any suggestions on modifying code below to accomplish this?

If ClsData.InsertUpdateProject(txtRASCode.Text, txtTask.Text, txtSubTask.Text, txtDesc.Text, StrtDte.Text, EndDte.Text, txtProjRegHrsAl.Text, txtProjOTHrsAl.Text) <> 0 Then
Response.Write("<script language='javascript'>window.alert('Database updated.');</script>")
Return
Else
'report error
Response.Write("<script language='javascript'>window.alert('Database did not update!');</script>")
Return
End If
Catch ex As Exception
Response.Write("<script language='javascript'>window.alert('Database did not update!');</script>")
Return
End Try

Thank you,

John
 
Thanks for the information. Did this instead:

Private Sub ShowMessage(ByVal psMessageToDisplay As String)
Try
Dim strBuilder As New StringBuilder
strBuilder.Append(" ")
ClientScript.RegisterStartupScript([GetType](), "alert", strBuilder.ToString())
Catch ex As Exception
Throw ex
End Try
End Sub
 
glad i was able to help :)
 
Back
Top