ASP.NET 2.0 DataList - properties set in ItemDataBound event not persisted during postback

If you have a DataList control and capture the ItemDataBound event like this:

Private Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound

And then suddenly have the urge to do something to e.item and expect it to exist after a postback you best be a suppressing that urge because nothing you do to e.item in the ItemDataBound event of a DataList control will survive a postback. The reason used to be described here:

No comments:

Post a Comment