How to disable default selection

Posted by: arunkumar on 8 September 2017, 2:19 pm EST

  • Posted 8 September 2017, 2:19 pm EST

    Hi, 


    I am using  Farpoint spread sheet. I have screen which contains spread and a button(delete). Whenever i am clicking delete button it is taking first row as active row and deleting that row but i don't want default selection as first row . How to resolve this?


    Can anyone help in this. 


     

  • Replied 8 September 2017, 2:19 pm EST

    Hello,

    You can try using the SetActiveCell property of Spread sheet to set the ActiveCell acccording to you rather than the default Cell[0,0]

          fpSpread1.ActiveSheet.SetActiveCell(rowIndex, colIndex);

          private void delete_Click(object sender, EventArgs e) // Delete
            {
                fpSpread1.ActiveSheet.Rows[fpSpread1.ActiveSheet.ActiveRowIndex].Remove();
            }

    Hope this will help you. Thanks.

  • Replied 8 September 2017, 2:19 pm EST

    Hello,

    You can try one more thing by using GetSelection method which gets the selection on this sheet with the specified index. And initially since the user didn;t selected any row, therefore he wont be able to delete it.

      fpSpread1_Sheet1.SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row;

           private void button1_Click(object sender, EventArgs e)
            {
                if (fpSpread1_Sheet1.GetSelection(0) != null)
                    fpSpread1_Sheet1.Rows[fpSpread1_Sheet1.ActiveRowIndex].Remove();
            }

    Hope this will help you. Thanks.

  • Replied 8 September 2017, 2:19 pm EST

    Hi Reeva,


    This is working. Thanks for help.

Need extra support?

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

Learn More

Forum Channels