This article tells how to link these web controls edit masters as MasterEditorAjaxLookUp and MasterEditorAjaxDropDown.

Methods MasterEditorAjaxLookUp

Creating dependent lyapov inside AGE

If lucapa are inside the AGE, then you need to use next method.

Work with LookUp’om from javascript

Subscription to change of value in LookUp’e

$('#<%=ctrlМойЛукап.ClientID%>').on('change', function () {
  // alert('Value changed'); 

Alternatively, you can specify client-side change handler in server code:

    lookup.ChangeClientHandler = "alert('Value changed in lucapa with ID {0}');";

Binding by using the server methods provided by technology

For specific control of the edit master (MasterEditorAjaxLookUp or MasterEditorAjaxDropDown) you can specify it workman the control (MasterEditorAjaxLookUp or MasterEditorAjaxDropDown), i.e. the one from which it depends. When changing control of the workman will be called server-side handler to modify the properties of dependent control.

// It is necessary to write only when all properties of controls surrounding WebBinder (type, etc.) 
ctrlSlave.AddMasterLookup(ctrlMaster, MasterOfSlaveChanged);

MasterOfSlaveChanged is a delegate of the form:

/// <summary> 
/// Delegate the processing of changing the values in the AJAX lucapa 
/// </summary> 
/// <param name="masterSelectedPk">the Current value of the workman lucapa</param> 
/// <param name="selectedPk">the Current value of the dependent lucapa</param> 
/// <param name="masterLookups">a List of other workmen of lyapov</param> 
public delegate void AjaxLookUpChangeHandler(
    string masterSelectedPk,
    ref string selectedPk,
    List<MasterLookup> masterLookups);

For example, if you want to clear dependent control, if purified of the artisan:

private void MasterOfSlaveChanged(string masterselectedpk, ref string selectedpk, List<MasterLookup> masterLookups)
    if (string.IsNullOrEmpty(masterselectedpk))
        selectedpk = string.Empty;

Also, you can change LimitFunction, etc.

In this handler comes to the value of the workman control - masterselectedpk and the value of the dependent control - selectedPk (passed by reference). (I.e. if selectedpk is changed, the javascript method is put the value and go another AJAX request to zachetku object selectedpk).

For example:

ctrl1.AddMasterLookup(ctrl2, ctrl1Ofctrl2Changed);
ctrl2.AddMasterLookup(ctrl1, ctrl2Ofctrl1Changed);

BUT: Artisan MasterEditorAjaxDropDown cannot be a dependent dependent control control type MasterEditorAjaxDropDown.

Переведено сервисом «Яндекс.Переводчик»