Access FormView in the ItemUpdated event

89 Views Asked by At

When I want to modify a FormView element like below, it works fine in the DataBound event, but it doesn't work with the ItemUpdated event (and also not with the ItemUpdating event). Why is that?

This works

Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.DataBound        
    cType(sender.FindControl("myField"),TextBox).text="Some value"  
End Sub

This does not work

Protected Sub FormView1_ItemUpdated(ByVal Sender As Object, ByVal e As FormViewUpdatedEventArgs) Handles FormView1.ItemUpdated
    cType(sender.FindControl("myField"),TextBox).text="Some value"  
End Sub
1

There are 1 best solutions below

0
esims On BEST ANSWER

It appears that there is a FormView.DataBound event after the FormView.ItemUpdated event, which causes this.