I have a grid bound to an empty dataset. When I load the form, it shows an empty row in the grid instead of showing the "Click Here to Add a New Item". As soon as I've added a row, the "Click Here to Add a New Item" row appears. How can I get it to show "Click Here to Add a New Item" at the start instead of showing an empty row?
8 Answers, 1 is accepted
Thank you for writing.
You should just set the current row to null:
Let me know if you have additional questions.
I found this "problem" also and came here with a quick search.
I think that this is not a correct behavior as in some of my grids users can enter an empty line, it look-alike empty, but the "False" checkboxes means something in the database. In this case, there is no difference between an empty grid (no rows) and a 1 row grid.
See attached picture.
I have tested with the latest version an a row is not added unless the user enters a value. The attached video shows how I am testing this. Am I doing something wrong? I have attached my test project as well.
I am looking forward to your reply.
I modified your project to reproduce, but cannot send it here :(
How to reproduce :
- click on the checkbox (checking it)
- reclick on the checkbox for unchecking it
- click in the textbox (row is created then lostfocus out of the grid)
- select the row previously inserted (which has the checkbox checked)
After the step 3, the just inserted (data) row is identical to the Add row (used for inserting new data) which is this my problem.
Thank you for the code I was able to reproduce this case. Please note that until the user clicks in the checkbox in the new row all values are null, after that the cell will have a value (true/false) and you cannot reset it to null from the UI. Once there is a value in a particular cell the row will be added to the grid. This is desired by design behavior. What you can do is use the grid events and cancel the new row adding for this exact case:
I hope this will be useful. Let me know if you have additional questions.
I am using the UserAddingRole already for inserting into our special data objects.
I don't want to cancel it because for us the row is valid; we insert a row in our data object.
Our problem with the grid is that this inserted line is identical to the AddRow when the grid contains any row. The user won't be able to differentiate between an empty grid and a grid with one empty row.
Why not having the "Click Here to Add a New Item" shown when the grid is empty, so at all time?
We think its a design flaw since the behavior is different from a "dumb & stupid" user's point of view.
Ok, I see your point now. I have logged this issue on our Feedback Portal. You can track its progress, subscribe to status changes and add your comment to it here. I have also updated your Telerik Points.
Until this is resolved you can manually set the row to null as described in my original post.
Should you have any other questions do not hesitate to ask.