UserControl.TryUpdateModel Method
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.
Attempts to update the model instance by using the values from the data-bound control.
TryUpdateModel<TModel>(TModel) |
Attempts to update the model instance by using the values from the data-bound control. |
TryUpdateModel<TModel>(TModel, IValueProvider) |
Attempts to update the model instance using values from the value provider. |
Attempts to update the model instance by using the values from the data-bound control.
public:
generic <typename TModel>
where TModel : class virtual bool TryUpdateModel(TModel model);
public virtual bool TryUpdateModel<TModel> (TModel model) where TModel : class;
abstract member TryUpdateModel : 'Model -> bool (requires 'Model : null)
override this.TryUpdateModel : 'Model -> bool (requires 'Model : null)
Public Overridable Function TryUpdateModel(Of TModel As Class) (model As TModel) As Boolean
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
Returns
true
if the model instance was updated successfully; otherwise, false
.
Remarks
The TryUpdateModel method must be invoked from inside a data-operation method of the control by using the ModelType
property for data binding.
Applies to
.NET Framework 4.8.1 және басқа нұсқалар
Өнім | Нұсқалар |
---|---|
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Attempts to update the model instance using values from the value provider.
public:
generic <typename TModel>
where TModel : class virtual bool TryUpdateModel(TModel model, System::Web::ModelBinding::IValueProvider ^ valueProvider);
public virtual bool TryUpdateModel<TModel> (TModel model, System.Web.ModelBinding.IValueProvider valueProvider) where TModel : class;
abstract member TryUpdateModel : 'Model * System.Web.ModelBinding.IValueProvider -> bool (requires 'Model : null)
override this.TryUpdateModel : 'Model * System.Web.ModelBinding.IValueProvider -> bool (requires 'Model : null)
Public Overridable Function TryUpdateModel(Of TModel As Class) (model As TModel, valueProvider As IValueProvider) As Boolean
Type Parameters
- TModel
The type of the model object.
Parameters
- model
- TModel
The model instance to update.
- valueProvider
- IValueProvider
A dictionary of values to use to update the model.
Returns
true
if the model instance was updated successfully; otherwise, false
.
Remarks
The TryUpdateModel method must be invoked from inside a data-operation method of the control using the ModelType
property for data binding.
Applies to
.NET Framework 4.8.1 және басқа нұсқалар
Өнім | Нұсқалар |
---|---|
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET кері байланысы
.NET — бастапқы коды ашық жоба. Пікір қалдыру үшін сілтемені таңдаңыз: