How to disable delete for certain rows please

Posted by: szilbermints on 12 February 2019, 11:03 am EST

  • Posted 12 February 2019, 11:03 am EST


    I want to make some rows non editable and non deletable.

    The following forks fine to disable editing for some rows but still allows to delete:

    fpSpread1.Sheets(0).Rows(jj).Locked = True
    fpSpread1.Sheets(0).Rows(jj).CanFocus = False

    Can you please specify if it can be done in server side code and how?

    Thank You
  • Replied 12 February 2019, 6:54 pm EST


    Please have a look at client side script code that shows how to disable the delete button for specific rows:-

    window.onload = function () {
    $$.j("#FpSpread1").on("ActiveCellChanged", function (e) {
    var event = e.originalEvent;
    var selectedRow = event.Row;
    //alert("Selected row " + selectedRow);


    var deleteButton = null;
    function disableButton(disabled) {
    if (deleteButton == null) {
    var imgs = $$.j("#FpSpread1 div.commandBar img");
    for (var i = 0; i < imgs.length; i++) {
    var $img = $$.j(imgs.get(i));
    if ($img.attr("onclick").indexOf(".Delete()") != -1) {
    // Disable delete button
    deleteButton = $img;

    if (deleteButton != null)
    deleteButton.attr("src", disabled ? deleteButton.attr("disabledimg") : deleteButton.attr("enabledimg"));

    function isAllowDelete(row) {
    /// <summary>Indicate whether a row is fine to delete</summary>

    return row != 1;

    Please have a look at attached sample as well for the same. Hope it helps.

  • Replied 13 February 2019, 1:32 am EST

    Thank You

    Any way to use property or something to do it with Server side code ?

  • Marked as Answer

    Replied 13 February 2019, 6:03 pm EST


    Unfortunately, there isn't any direct server side property to achieve the same.

    We regret the inconvenience.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels