The ModeChanged event is raised when a FormView control attempts to switch between edit, insert, and read-only mode, but after the mode actually changes. This allows you to provide an event-handling method that performs a custom routine, such as synchronizing the FormView control with another control, whenever this event occurs.
For Example:
Say in your html you have a FormView declared like:
<asp:formview id="FormView1"
datasourceid="FormViewSource"
allowpaging="true"
datakeynames="ItemID"
headertext="Read-Only Mode"
headerstyle-backcolor="Green"
emptydatatext="No records found."
onmodechanged="FormView1_ModeChanged"
runat="server">
Then in your codebehind you have your ModeChanged subroutine.
Sub FormView1_ModeChanged(ByVal sender As Object, ByVal e As EventArgs)
'Display the current mode in the header row.
Select Case FormView1.CurrentMode
Case FormViewMode.Edit
FormView1.HeaderText = "Edit Mode"
FormView1.HeaderStyle.BackColor = System.Drawing.Color.Red
Case FormViewMode.ReadOnly
FormView1.HeaderText = "Read-Only Mode"
FormView1.HeaderStyle.BackColor = System.Drawing.Color.Green
Case Else
FormView1.HeaderText = "Unsupported mode."
FormView1.HeaderStyle.BackColor = System.Drawing.Color.Yellow
End Select
End Sub
If you post some code or give a more detailed explaination of what you are trying to accomplish, we may be able to help more.