Force save rows in a gridview

We have a few forms that use a gridview to collect data. Every once in a while a form gets submitted with an empty gridview.
It seems that customers are able to submit the form when the gridview row is still in edit mode. Is there a way to either force save the gridview row when the form is submitted, or at least prevent the form from being submitted?


In the Form designer’s Behaviour feature, you can set the gridview as required. This will make sure the gridview contains at least one row before submitting.


Hi Eddy,
We do that already, but it doesn’t help in the case when they are adding more than one row, and they don’t save the last row.
There needs to be a way to check that the gridview has been saved before submitting the form.

I should also add, that on another of our forms, the gridview is optional. But when it is used, we still need to make sure that the user doesn’t submit when the gridview is in edit mode.

Hi @dcarruth,

Unfortunately, that’s how a regular ASP.NET GridView works.
The user needs to click on the Update button so that it triggers a postback and the info is saved in the backend.

You can always find a way to make it work in code behind but it will be complex:

  • You have to make sure you’re not saving an empty row
  • You have to make sure the data is valid before saving (for example putting text in a number field)
  • If you are using any calculations in the footer, you’ll have to also update the footer. (Sum of all rows)

My recommendation is to train the employees to be careful when adding rows to the GridView and change the process to allow the request to be sent back to the user if the row was missing.