This documentation is archived and is not being maintained.
DynamicDataExtensions::ConvertEditedValue Method
Visual Studio 2010
Returns the value provided by a user for a control that is being validated.
Assembly: System.Web.DynamicData (in System.Web.DynamicData.dll)
[ExtensionAttribute] public: static Object^ ConvertEditedValue( IFieldFormattingOptions^ formattingOptions, String^ value )
Parameters
- formattingOptions
- Type: System.Web.DynamicData::IFieldFormattingOptions
The formatting options object, as defined by the IFieldFormattingOptions object.
- value
- Type: System::String
The input value to be converted.
Return Value
Type: System::Objectnullptr if value is nullptr or an empty string and the ConvertEmptyStringToNull property of formattingOptions is true; nullptr if value is not nullptr or an empty string and matches the NullDisplayText property of formattingOptions; otherwise, the unchanged value of value.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IFieldFormattingOptions. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).For information about formatting options, see the IFieldFormattingOptions type overview.
The following example shows how to use the ConvertEditedValue() method. The example gets user input from a field template that is configured to accept date-time data. In the DynamicData\FieldTemplates\DateTime_Edit.ascx.cs or DynamicData\FieldTemplates\DateTime_Edit.ascx.vb file, the method converts empty strings to nullptr.
protected override void ExtractValues(IOrderedDictionary dictionary) { dictionary[Column.Name] = ConvertEditedValue(TextBox1.Text.Trim()); // dictionary[Column.Name] = ConvertEditedValue(TextBox1.Text); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: