View Single Post
  #1 (permalink)  
Old November 18th, 2004, 08:11 AM
eoghan eoghan is offline
Registered User
 
Join Date: Nov 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default ViewState and ItemCreated

Scenario:
I have a datalist which gets databound when !IsPostBack

When IsPostBack:
A user may have edited some of the textboxes in it, so I want to get the updated values.
I do this with the OnItemCreated event by:
TextBox mybox = (TextBox)e.Item.FindControl("tbox_id");
mybox.Text;
Unfortunately, mybox.Text turns out to be empty, even though I have EnabledViewState on.
Subsequently, however, the textbox text is preserved (through the viewstate I presume), and shows up on the page, but this restoration of state seems to happen after the ItemCreated event.

Any ideas of how to get the state of controls from within the ItemCreated event?