hey folks,
I've got a problem. I created a function that creates a javascript alert. it works fine for the invalid date call, but not for the updated call. I have used this function on several other projects and have had no problems with it until now. If stepped through the debugger and it hits the call, it goes through the js function, but no alert comes up. any ideas?
Private Sub btnChg_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnChg.Click
Dim objEmployee As New Employee.Business.Employee(CInt(Request.QueryString("id")))
Dim objemployee2 As New Employee.Business.Employee(cboSup.SelectedItem.Value)
If Not txtStartDate.Text = "" And Not txtStartDate.Text = " " Then
If IsDate(txtStartDate.Text) Then
objEmployee.StartDate = txtStartDate.Text
Else
scriptAlert("InvalidDate", "Start Date is Invalid")
Exit Sub
End If
Else
objEmployee.StartDate = Null.NullDate
End If
'uneccesary code removed
If objEmployee.Update() Then
scriptAlert("Updated", txtFName.Text + " " + txtLName.Text + "'s record has been updated.")
Else
scriptAlert("NotUpdated", txtFName.Text + " " + txtLName.Text + "'s record could not be updated.\nPlease check your values.")
End If
Response.Redirect("EmployeeListing.aspx")
End Sub
function that creates js alert
Private Sub scriptAlert(ByVal key As String, ByVal message As String)
Dim scriptKey As String = key
Dim javaScript As String = "<script type='text/javascript' language=""JavaScript"">alert(""" + message + """);</script>"
ClientScript.RegisterClientScriptBlock(Me.GetType(), scriptKey, javaScript)
End Sub