Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
785
When focued on the cell how to delete the entire row?
posted

Hi,

Recently I'm using UltraGird and want to implement the delete row action.Here is what I got, I implement a delete button on the winform, and with the button click event like this:

private void del_click(object sender, EventArgs e)

{

    this.PerformAction(UltraGridAction.DeleteRows, false, true);

}

What if I also want to delete the selected row when I focued on the row's cell? In another words, when I focued on the cell, and I click the delete button, how could I delete the entire row which the cell within? Should I get the row index and then to delete it ?

Could you please help me with that? Thanks for your concern.

Parents
No Data
Reply
  • 23930
    Verified Answer
    Offline posted

    Hi Richard,

    Thank you for posting in our forums.

    What you can do in order to achieve this is in your button click event to check if the ActiveCell property is null. If it isn’t get the cell’s row and select it:

    private void del_click(object sender, EventArgs e)

    {

                if (ultraGrid1.ActiveCell != null)

                {

                    ultraGrid1.ActiveCell.Row.Selected = true;

                }

    }

    I have attached a sample demonstrating this suggestion.

    Please let me know if you have any additional questions.

    WG_DeleteRowWithSelectedCell.zip
Children