Protected Sub gv_PianiMedia_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
If e.CommandName = "ValidaPiano" Then
Dim parametri As String() = New String(3) {}
Dim id As Integer = 0
parametri = e.CommandArgument.Split("#")
ValidaPiano(parametri(0), parametri(1), parametri(2))
End If
End Sub
Protected Sub gv_PianiMedia_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim _placeHolder As PlaceHolder = TryCast(e.Row.FindControl("MyPlaceHolder"), PlaceHolder)
If _placeHolder IsNot Nothing Then
'****************************************************************************************************************
' DIRETTORE
'****************************************************************************************************************
Dim strStatoDirCDG As Integer = CInt(gv_PianiMedia.DataKeys(e.Row.DataItemIndex)("Stato_DirCDG"))
Select Case strStatoDirCDG
Case "0"
Dim _imgButton As New ImageButton()
_imgButton.ImageUrl = ConfigurationManager.AppSettings("webApp") & "Immagini/check.png"
_imgButton.Style.Value = "border:0; height:18px; width:18px;"
_imgButton.CommandArgument = gv_PianiMedia.DataKeys(e.Row.DataItemIndex)("Id").ToString() & "#1#1"
_imgButton.CommandName = "ValidaPiano"
_placeHolder.Controls.Add(_imgButton)
Dim _imgButton2 As New ImageButton()
_imgButton2.ImageUrl = ConfigurationManager.AppSettings("webApp") & "Immagini/del.gif"
_imgButton2.Style.Value = "border:0; height:18px; width:18px;"
_imgButton2.CommandArgument = gv_PianiMedia.DataKeys(e.Row.DataItemIndex)("Id").ToString() & "#1#2"
_imgButton2.CommandName = "ValidaPiano"
_placeHolder.Controls.Add(_imgButton2)
Case "1"
Dim _Image As New Image()
_Image.ImageUrl = ConfigurationManager.AppSettings("webApp") & "Immagini/check.png"
_Image.Style.Value = "border:0; height:18px; width:18px;"
_placeHolder.Controls.Add(_Image)
Case "2"
Dim _Image As New Image()
_Image.ImageUrl = ConfigurationManager.AppSettings("webApp") & "Immagini/del.gif"
_Image.Style.Value = "border:0; height:18px; width:18px;"
_placeHolder.Controls.Add(_Image)
End Select
Else
Trace.Warn("ERRORE -1-")
End If
End If
End Sub
Public Function ValidaPiano(ByVal strId As String, ByVal strDirettore As String, ByVal strStato As String) As String
Dim strSql As String = ""
Dim DirettoreDB As String = ""
Dim strMsg As String = ""
Try
If Page.IsPostBack Then
'****************************************
'strValida 0 = richiesta di validazione
' 1 = piano validato
' 2 = piano NON validato
'****************************************
DirettoreDB = "DirettoreCDG"
StatoDB = "Stato_DirCDG"
strSql = "UPDATE XXX SET " & DirettoreDB & "='" & Session("NomeUtente") & "', " & StatoDB & "=" & strStato
strSql = strSql & " WHERE Id=" & strId
Dim ds1 As DataSet = DB.execQuery(strSql)
If ds1.Tables.Count = 0 Then
strMsg = "<script type=""text/javascript"">alert('Operazione avvenuta correttamente.');window.reload();</script>"
Response.Write(strMsg)
Else
strErr = ""
strErr = "Valida Piano Media - RicercaPianiValidati.aspx -1-"
Funzioni.redirectPageError(strErr, "")
strErr = strErr & " - Valida Piano Media - "
Log.scriviLog(strErr)
strMsg = "<script type=""text/javascript"">alert('" & Replace(strErr, "'", "\'") & "');</script>"
End If
ds1.Dispose()
ds1 = Nothing
End If
Catch ex As Exception
strErr = ""
strErr = "Valida Piano Media "
Funzioni.redirectPageError(strErr, "")
strErr = strErr & " - Valida Piano Media - " & ex.ToString()
Log.scriviLog(strErr)
End Try
Return strMsg
End Function
ho riportato un pò di codice ... come vedi nella funzione faccio un update .... come ho scritto prima ho provato a mettere un msg in js ma nada risultati ...