Home Forums WinForms controls Xceed Grid for WinForms insertionrow BringIntoView error

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16347 |

    Hi,

    Can anyone tell me the reason behind this error? It is an InvalidOperationException and the error message is “An attempt was made to bring into view a row that does not belong to a grid.”

    I have a data bound grid (bound to a database) and an insertion row. It seems to me that whenver I try to add a new row (via insertion row) which contains the same values as one of the existing rows on the grid, then this error would be thrown out at insertionRow.BringIntoView(). Is it the cause of the error that I try to insert duplicate row into the grid? And, how can I avoid getting this error?

    Thanks in advance.

     

    Imported from legacy forums. Posted by Sop (had 726 views)

    User (Old forums)
    Member
    Post count: 23064

    Let me try to describe the situation more clearly. It seems to me that the error is thrown when trying to insert row which has values of primary key the same as that of one of the existing rows on the grid. (ie. not duplicate row values, but duplicate primary key values)

     Thanks.

    Imported from legacy forums. Posted by Sop (had 447 views)

    User (Old forums)
    Member
    Post count: 23064

    Not sure I understand exactly the issue.  Why do you call InsertionRow.BringIntoView()?  Isn’t the InsertionRow already visible when a row is being added to the grid, since this is the user inserting a row in the grid?

    Does your primary key supports duplicates?  If not, it would explain the exception.  If you use a unique primary key (one not present in the data source), does it work?

    If so, you have a few choices.  Always use unique primary keys, or set your DB to accept duplicates, or if the primary key is an integer, you can set the DB to automatically generate the key when a row is inserted (the grid will automatically update with the right number when a row is inserted).

     

    Imported from legacy forums. Posted by André (had 1241 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.