you also check this link please , by thw way ur link is not working. So, the View State with all of the data for your Grid View is loaded just after the Init event.
This makes the data in your Grid View is available in the Page Load event...including data entered by the user.
Ok the reason why you aren't losing data is because you are only doing your Data Bind in your Page Load event the first time the page is loaded (if ! This way your data is not getting over written when the user-provided-edit-data is posted back to the server.
But do you notice how you are calling the display() method in several different places?
I'm not even sure you have a question at this point...
I like to be in more control of my database connections. You could do this in your Page Load event if you want to.