Continuo a cappellare 'ste cose banali:
Dopo un insert di una serie di dati da un formview vorrei informare l'utente che la cosa è andata a buonfine o meno ed ho questo codice
Protected Sub formview_Inserted(sender As Object, e As FormViewInsertedEventArgs)
Dim almes As String = ""
If (Not IsNothing(e.Exception)) Then
' mostro error message e resto nella pagina
almes = "alert('Si è verificato un errore tentando di inserire il cliente, verificare i dati e riprovare\!);"
e.ExceptionHandled = True
e.KeepInInsertMode = True

Else

If (e.AffectedRows > 0) Then
' mostro success message e ridirigo
almes = "alert('Inserimento del nuovo cliente " & Replace(e.Values("an_descr1").ToString, "'", "\'") & " correttamente eseguito.');window.location.href = 'rubrica.aspx';"
Else
' mostro error message e resto nella pagina
almes = "alert('Si è verificato un errore tentando di inserire il cliente, verificare i dati e riprovare\!');"
e.KeepInInsertMode = True
End If
End If
If Not Page.ClientScript.IsStartupScriptRegistered(Me.Get Type(), "AlertScript") Then
Page.ClientScript.RegisterStartupScript(Me.GetType (), "AlertScript", almes)
End If
'Page.ClientScript.RegisterClientScriptBlock(Me.Ge tType(), "MyScript", almes, True)
End Sub
che non va... una volta fatto l'insert/update correttamente, poi non esegue nessun alert JS, provato sia con registerclientscriptblock che registerstartupscript.
Credo che ci sia un legame col fatto che il tutto gira in un updatepanel ajax ma non so mai come muovermi... c'è un sant'uomo che mi spiega come funziona 'sta cosa?