Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
115 lines (107 sloc) 7.16 KB
<Type Name="FormViewMode" FullName="System.Web.UI.WebControls.FormViewMode">
<TypeSignature Language="C#" Value="public enum FormViewMode" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed FormViewMode extends System.Enum" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.FormViewMode" />
<TypeSignature Language="VB.NET" Value="Public Enum FormViewMode" />
<TypeSignature Language="C++ CLI" Value="public enum class FormViewMode" />
<TypeSignature Language="F#" Value="type FormViewMode = " />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Enum</BaseTypeName>
</Base>
<Docs>
<summary>Represents the different data-entry modes of a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormViewMode> enumeration is used to represent the data-entry modes of a <xref:System.Web.UI.WebControls.FormView> control. To determine the current mode of the control, use the <xref:System.Web.UI.WebControls.FormView.CurrentMode%2A> property. After an insert or update operation, the <xref:System.Web.UI.WebControls.FormView> control returns to the mode specified by the <xref:System.Web.UI.WebControls.FormView.DefaultMode%2A> property. By default, the control returns to read-only mode. You can specify an alternate mode to return to by setting the <xref:System.Web.UI.WebControls.FormView.DefaultMode%2A> property. To change modes programmatically, use the <xref:System.Web.UI.WebControls.FormView.ChangeMode%2A> method. When the <xref:System.Web.UI.WebControls.FormView> control changes modes, the events in the following table are raised.
|Event|Description|
|-----------|-----------------|
|<xref:System.Web.UI.WebControls.FormView.ModeChanging>|Occurs when a <xref:System.Web.UI.WebControls.FormView> control attempts to change between edit, insert, and read-only mode, but before the mode actually changes. This event is often used to cancel a mode change.|
|<xref:System.Web.UI.WebControls.FormView.ModeChanged>|Occurs after a <xref:System.Web.UI.WebControls.FormView> control has changed from edit, insert, or read-only mode to another mode. This event is often used to perform a task when the <xref:System.Web.UI.WebControls.FormView> control changes modes.|
## Examples
The following example demonstrates how to keep the <xref:System.Web.UI.WebControls.FormView> control in edit mode after an update operation by setting the <xref:System.Web.UI.WebControls.FormView.DefaultMode%2A> property to `FormViewMode.Edit`.
> [!IMPORTANT]
> This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see [Script Exploits Overview](https://msdn.microsoft.com/library/772c7312-211a-4eb3-8d6e-eec0aa1dcc07).
[!code-aspx-csharp[FormViewDefaultMode#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewDefaultMode/CS/formviewdefaultmodecs.aspx#1)]
[!code-aspx-vb[FormViewDefaultMode#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewDefaultMode/VB/formviewdefaultmodevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.FormView" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CurrentMode" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DefaultMode" />
<altmember cref="P:System.Web.UI.WebControls.FormViewModeEventArgs.NewMode" />
<altmember cref="M:System.Web.UI.WebControls.FormView.ChangeMode(System.Web.UI.WebControls.FormViewMode)" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanging" />
</Docs>
<Members>
<Member MemberName="Edit">
<MemberSignature Language="C#" Value="Edit" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Web.UI.WebControls.FormViewMode Edit = int32(1)" />
<MemberSignature Language="DocId" Value="F:System.Web.UI.WebControls.FormViewMode.Edit" />
<MemberSignature Language="VB.NET" Value="Edit" />
<MemberSignature Language="C++ CLI" Value="Edit" />
<MemberSignature Language="F#" Value="Edit = 1" Usage="System.Web.UI.WebControls.FormViewMode.Edit" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewMode</ReturnType>
</ReturnValue>
<MemberValue>1</MemberValue>
<Docs>
<summary>An editing mode that allows the user to update the values of an existing record.</summary>
</Docs>
</Member>
<Member MemberName="Insert">
<MemberSignature Language="C#" Value="Insert" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Web.UI.WebControls.FormViewMode Insert = int32(2)" />
<MemberSignature Language="DocId" Value="F:System.Web.UI.WebControls.FormViewMode.Insert" />
<MemberSignature Language="VB.NET" Value="Insert" />
<MemberSignature Language="C++ CLI" Value="Insert" />
<MemberSignature Language="F#" Value="Insert = 2" Usage="System.Web.UI.WebControls.FormViewMode.Insert" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewMode</ReturnType>
</ReturnValue>
<MemberValue>2</MemberValue>
<Docs>
<summary>An inserting mode that allows the user to enter the values for a new record.</summary>
</Docs>
</Member>
<Member MemberName="ReadOnly">
<MemberSignature Language="C#" Value="ReadOnly" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.Web.UI.WebControls.FormViewMode ReadOnly = int32(0)" />
<MemberSignature Language="DocId" Value="F:System.Web.UI.WebControls.FormViewMode.ReadOnly" />
<MemberSignature Language="VB.NET" Value="ReadOnly" />
<MemberSignature Language="C++ CLI" Value="ReadOnly" />
<MemberSignature Language="F#" Value="ReadOnly = 0" Usage="System.Web.UI.WebControls.FormViewMode.ReadOnly" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewMode</ReturnType>
</ReturnValue>
<MemberValue>0</MemberValue>
<Docs>
<summary>A display mode that prevents the user from modifying the values of a record.</summary>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.