Hi Michael,
I think you may need try and catch the TextChanged event of textbox and
maintain a viewstate variable ot indicate if the text has changed.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'populate the textbox
If Not IsPostBack Then
TextBox1.Text = "hello"
TextBox2.Text = "world"
viewstate("change") = False
'initialize the st
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
viewstate("change") = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If viewstate("change") Then
Dim scriptString As String = "<script language=JavaScript>
alert('Please save first')"
scriptString += "</script>"
If (Not Me.IsStartupScriptRegistered("Startup")) Then
Me.RegisterStartupScript("Startup", scriptString)
End If
Else
Response.Redirect("http://www.google.com")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
'Do save issue
viewstate("change") = False
End Sub
If you have any concern please post here.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.