Goal: to avoid a situation where the number of goods in stock is subtracted several times, it is necessary to organize the blocking of the status of the order, if the order is already paid for.

To implement this behavior you need to correct the method PostApplyToControls() in the form’s code editing order ZakazE.aspx.cs as follows:

protected override void PostApplyToControls()
{
	if ((DataObject != null) && (DataObject.Статус == СостояниеЗаказа.Оплаченный))
	{
		wb.SetReadonlyToControl(ctrlСтатус, true);
	}

	Page.Validate();
}

Method PostApplyToControl() called just for AfterApplyToControls(), a method AfterApplyToControl(), in turn, is called after the distribution of the data object on the controls page. At the time of calling this method, all controls on the page have been updated in accordance with the data object.

Go

Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru