views:

37

answers:

0

I have a question about ASP.Net data binding - for a small internal tool I'm creating.

Simplifying the scenario, there's a page with some Repeater controls to display lists/tables, and also some edit boxes. Within Page_Load() I bind all the Repeaters from a business object (stored in ApplicationState). If it's not a postback then I also set the values of the text boxes from the business object.

The problem is that binding to lists in ASP.Net seems to be two-way, while binding to a string or int seems to be one-way. If I delete an item from the Repeater control then load the page later, the item remains deleted as the business object is in ApplicationState. However, if I edit a TextField, the changes are lost as soon as I navigate away. This could be solved with a Save button.

I don't mind if all values are automatically saved, or if no values are saved until you click a button, but this hybrid behaviour is a really bad user experience. If I could override some kind of BeforePostBack() method, then this would work.

Any help appreciated.