Public Class modNews2_aspx
Inherits System.Web.UI.Page
Protected WithEvents BtnCancImg As System.Web.UI.WebControls.ImageButton
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: questa chiamata al metodo è richiesta da Progettazione Web Form.
'Non modificarla nell'editor del codice.
InitializeComponent()
'conferma della cancellazione dell'immagine allegata
BtnCancImg.Attributes.Add("onclick", "return confirm('È sicuro di voler cancellare l\'immagine allegata?');")
'conferma della cancellazione del documento allegato
BtnCancAlle.Attributes.Add("onclick", "return confirm('È sicuro di voler cancellare il documento allegato?');")
End Sub
Private Sub BtnCancImg_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles BtnCancImg.Click
Dim mySql = "DELETE img FROM news WHERE ID = " & IDnews & ";"
MyConnectionSQL = New SqlConnection(Application("strConnSQL"))
MyCommandSQL = New SqlCommand(mySql, MyConnectionSQL)
If MyCommandSQL.Connection.State <> ConnectionState.Open Then
MyCommandSQL.Connection.Open()
End If
If MyCommandSQL.Connection.State <> ConnectionState.Closed Then
MyCommandSQL.Connection.Close()
End If
modifica()
lbl_immagine.Text = "L'mmagine è stata cancellata!"
BtnCancImg.Visible = False
End Sub