예제 #1
0
 public static ActiveDotvvmProperty RegisterCommandToAttribute <TDeclaringType>(string name, string attributeName)
 {
     return(DelegateActionProperty <object> .Register <TDeclaringType>(name, (writer, context, value, control) =>
     {
         var binding = value as ICommandBinding;
         var script = KnockoutHelper.GenerateClientPostBackScript(name, binding, context, control);
         writer.AddAttribute(attributeName, script);
     }));
 }
예제 #2
0
 public static ActiveDotvvmProperty RegisterCommandToAttribute <TDeclaringType>(string name, string attributeName)
 {
     return(DelegateActionProperty <ICommandBinding> .Register <TDeclaringType>(name, (writer, context, property, control) =>
     {
         var binding = control.GetCommandBinding(property) ?? throw new Exception($"Command binding expression was expected in {property}.");
         var script = KnockoutHelper.GenerateClientPostBackScript(name, binding, control);
         writer.AddAttribute(attributeName, script);
     }));
 }