Just a small thought that just occurred to me.
I was just creating a quick form, where I pull a list of inputs from the database in to generate a form of those inputs and their current values. In order to do this, I write some code which creates a load of controls and adds them to the ASP.NET form dynamically during form creation. This is something that I do quite frequently, and it has become second nature to seperate the creation of the controls from the setting of the values in those controls, and to ensure that whilst all the controls are created during a postback, that the values are not set. (As they'll be set by the rather clever ASP.NET postback mechanism).
This does however mean that on a postback (When the submit button - or even cancel button is clicked), I am pulling the values from the database and creating a pile of controls so that I can cycle through them and retrieve their new values before updating the database.
Over the past week I have been allocating more and more work to the client via Javascript, and performing a lot of actions asynchronously- where it makes sense to do so, and I had a sudden "woah" moment when I caught myself starting to write some javascript to submit these new values once the user clicked the submit button. I had to stop and remind myself what the purpose of adding asynchronous behaviour actually was. The purpose is to add a fluid and faster user experience when a full postback to the server just simply isn't necessary.
Rather than creating all those controls again, a simple check to whether it's a postback, and then a loop through the inputs would suffice. Once that is done, the page re-directs back to the view screen so those controls never needed re-creating.
Once again - the zealous overdesign of ASP.NET covers up something that in PHP would be stonkingly obvious (And indeed, is the defacto standard method of handling such problems). I almost didn't do it because I'm so used to working within this friendly framework of controls and forms.
Silly Rob... silly Rob.
Remember Me