DynamicDataExtensions.ConvertEditedValue Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the value provided by a user for a control that is being validated.
public:
[System::Runtime::CompilerServices::Extension]
static System::Object ^ ConvertEditedValue(System::Web::DynamicData::IFieldFormattingOptions ^ formattingOptions, System::String ^ value);
public static object ConvertEditedValue (this System.Web.DynamicData.IFieldFormattingOptions formattingOptions, string value);
static member ConvertEditedValue : System.Web.DynamicData.IFieldFormattingOptions * string -> obj
<Extension()>
Public Function ConvertEditedValue (formattingOptions As IFieldFormattingOptions, value As String) As Object
Parameters
- formattingOptions
- IFieldFormattingOptions
The formatting options object, as defined by the IFieldFormattingOptions object.
- value
- String
The input value to be converted.
Returns
null
if value
is null
or an empty string and the ConvertEmptyStringToNull property of formattingOptions
is true
; null
if value
is not null
or an empty string and matches the NullDisplayText property of formattingOptions
; otherwise, the unchanged value of value
.
Examples
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 null
.
protected override void ExtractValues(IOrderedDictionary dictionary) {
dictionary[Column.Name] = ConvertEditedValue(TextBox1.Text.Trim());
// dictionary[Column.Name] = ConvertEditedValue(TextBox1.Text);
}
Remarks
For information about formatting options, see the IFieldFormattingOptions type overview.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기