ASP.NET handling button click event before OnPreInit
- by Phillykins
Hello,
I have a data access layer, a business logic layer and a presentation layer (ie. the pages themselves).
I handle the OnPreInit event and populate collections required for the page. All the data comes from an SQL server database and I do not use caching.
I handle a button click event to grab values from a form and insert a new object into the database. The problem is that by the time I handle the click event, the collections have already been populated, so the new item which has been inserted into the database has not been retrieved.
What is the accepted solution to this?
I could insert the new object directly into the collection and re-bind the GridView, but the SQL query selects only a set of objects and the new object could fall outside of this set.
Thanks!