05 October 2011

Personalizzare confirm OnClientClick


Protected Sub gridDocs_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gridDocs.RowDataBound

  With e.Row
    If .RowType = DataControlRowType.DataRow Then

      Dim s As String = "return confirm('Eliminare il documento \'"
      s &= DataBinder.Eval(.DataItem, f1.Descrizione.ToString).ToString & "\'?');"

      Dim btn As Button = CType(.FindControl("cmdDelete"), Button)
      btn.OnClientClick = s

    End If
  End With

End Sub