ASP.NET handling button click event before OnPreInit

Posted by Phillykins on Stack Overflow See other posts from Stack Overflow or by Phillykins
Published on 2010-03-18T20:26:59Z Indexed on 2010/03/18 20:31 UTC
Read the original article Hit count: 277

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#