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
330
How to find out if the data grid has a pending row addition
posted

HI GUys, this may have many answers but for the life of me I have searched this forum all day.

My problem is as follows:

I have a grid which can accept new entries, how ever, on one of the columns there is a primary constraint. And of course, it wont allow the addition of the new record due to a violation if the user enters a duplicate value.

1. Now, what I am trying to do , is , on the click of the SAVE button, look if there are (is) any new rows added (the ones with the *) BUT also if there have been any errors thrown such as the abovementioned.

To which I want to  advise the user and cancel the save action.

At the moment what happens is that the save action occurs, BUT the pending row remains active and of course if you try to move away from that row it warns about the violation.

2. I would so dearly like to remove that violating row as well. Programmatically. In other words, do what the ESC button or the cancel button of the RowINsertTemplate does.

I hope I am as clear as mud here??

Regds

Paul F

Parents
No Data
Reply
  • 330
    Verified Answer
    posted

    Hi Guys, I solved it as follows:

    //check if the ADDROW is still current

    if (r.IsAddRow)

    {

    //remove the addrow

    r.CancelUpdate();

    writeError("Removing the erroneous insert row and saving the rest.");

    //exit loop

    break;

    }

    regds

    Paul

Children
No Data