FormView Event Question
I am trying to set the value of a drop down list to null or "" after a FormView EditItemTemplate control has fully loaded. It is databound, but I need the user to change the value of the control upon an Update command. I have tried putting the code to do so in various events of the FormView.
Sub UpdateRESETUPDATEDBY()
Dim UPDATEDBYDropDownList As New DropDownList
UPDATEDBYDropDownList = FormView1.FindControl("UPDATEDBYDropDownList")
UPDATEDBYDropDownList.Text = ""
End Sub
However, when I place the code in events such as ModeChanged, or ModeChanging it gives me the following error:
Object reference not set to an instance of an object.
I don't see where there is a FormView event like the Page class has. It has the Page_LoadComplete. I think this is the type of event I am looking for, because with the other FormView events it appears that the instance of the drop down list control has not yet been created. It looks like I need an event that takes place immediately after all controls have been fully loaded, and the FormView is done loading. This would allow me to set the value.
I have also tried to use the SqlDataSource_Updating event to verify if the code works. It does, but as expected, it sets the value to null each time the FormView Update command is invoked.
Any help is greatly appreciated...
|