Hi All, I am facing a problem while developing a CR which is add new row to middle of the grid. Adding a new row is not an issue. But the grid row index numbers got messy after add the new row to the middle. I got below shown row number issue and try to fix it by reset order in runtime. That was failed. Can someone please conduct me to solve this.
Thanks..
Hello,
From the screenshot attached, I believe that you are using RowNumberingStyle set to RowIndex and you are inserting rows to the band of the grid and then moving the row to the middle of the grid with the Move method and thus the record selector numbers show the last index. There are two ways to overcome this, you could either change the RowNumberingStyle to VisibleIndex, which would ensure that the row selector numbers are ordered in the way they appear visually or insert the row directly to the data source of the grid.
I am attaching a small sample that demonstrates what I have explained above. Please test in on your side and let me know if you have any questions.
Regards, Ivan Kitanov
RowNumberingIssue.zip
Hi Ivan,
I really appreciate your quick response. I tried a test form as per your sample code and it works with a new grid(without any properties change in ultragrid designer). But that not works with my existing grid it looks same as I informed earlier. In below, I have mentioned more details about my development. Could you please look into them and let me know if there is something I missed and also is there any designer property effects on this.
* Programming Language - vb.net
* RowSelectorNumberStyle property was set to VisibleIndex in form load.
* My AddNewRow code.
* Result.
Hello Gimhan,
From the provided code I believe that the logic for adding rows is similar to the sample that I have sent, so the issue should not be in the code for adding a new row.
What might be the cause of the issue is actually loading a loadout for the grid that overrides the RowSelectorNumberStyle, so if you are loading a loadout you would need to ensure that the RowSelectorNumberStyle property is set afterwards.
If this is not the case could please provide the properties you are setting for your grid?
Looking forward to hearing from you.
Thank you for your quick response. May I know what you have meant by 'loading a loadout for the grid'.
Hello Ginham,
I meant saving the grid layout to a file and then loading, more information regarding it could be found here.
If that is not the case could you please provide the properties you are setting for the grid as well as some code snippets, which you believe that may cause the issue.