We have a RadListview which is binding to a DataSource control and have item, edit and insert templates.
The datasource control takes care of selecting the object when the page loads and does the data bind. The datasource control (actually a CslaDataSource control) binds to our business layer objects which are enumerable, and we just show one "record" in the listview.
Really we are making use of the templating to show display, edit and insert modes for our record/object.
We also tend to have our own user controls also in the templates and pass the business object down to them so they can bind to their respective controls.
All works well.
Except we have one slight issue. When inserting a new record and attempting a save, the datasource control xxx_Update method gets fired and if the business object throws an error (typically as some business rule is broken and it cannot be saved yet), the RowsAffected is zero and we set a PageHasErrors flag.
The page posts back and in our Page_PreRender event we try and switch the listview back into Insert mode as we want to keep it there in that template as the save failed. Unfortunately this doesn't quite work as we end up with the display item template shown first and then the insert template below.
It almost looks like it has created 2 records in the listview.
Any ideas?
The datasource control takes care of selecting the object when the page loads and does the data bind. The datasource control (actually a CslaDataSource control) binds to our business layer objects which are enumerable, and we just show one "record" in the listview.
Really we are making use of the templating to show display, edit and insert modes for our record/object.
We also tend to have our own user controls also in the templates and pass the business object down to them so they can bind to their respective controls.
All works well.
Except we have one slight issue. When inserting a new record and attempting a save, the datasource control xxx_Update method gets fired and if the business object throws an error (typically as some business rule is broken and it cannot be saved yet), the RowsAffected is zero and we set a PageHasErrors flag.
The page posts back and in our Page_PreRender event we try and switch the listview back into Insert mode as we want to keep it there in that template as the save failed. Unfortunately this doesn't quite work as we end up with the display item template shown first and then the insert template below.
It almost looks like it has created 2 records in the listview.
Any ideas?