편집

다음을 통해 공유


UserControl.TryUpdateModel Method

Definition

Attempts to update the model instance by using the values from the data-bound control.

Overloads

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.

TryUpdateModel<TModel>(TModel)

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

TryUpdateModel<TModel>(TModel, IValueProvider)

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