Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PostBack.Handlers in CompositeControls #1703

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

exyi
Copy link
Member

@exyi exyi commented Sep 27, 2023

PostBack.Handlers are copied onto the created controls, if they contain a matching command binding.

  • We map postback handlers onto the command bindings set on the CompositeControl by comparing the EventName and property name
  • For each control returned from GetContents, we enumerate its command bindings and compare them to the command bindings found on the CompositeControl.
  • If a matching command binding is found, we clone its postback handlers onto the child control. EventName is adjusted to match the new property name

The control enumeration is done recursively before adding the control to Children, thus walking only through the tree created in this CompositeControl - nested CompositeControls,
initialized Repeaters, ... are not included.

In order to support templatws created in the CompositeControl, we recurse into CloneTemplates. For DelegateTemplate or any other more advanced needs, a protected
CopyPostBackHandlersRecursive method is provided.

resolves #1699

PostBack.Handlers are copied onto the created controls, if they
contain a matching command binding.

* We map postback handlers onto the command bindings set on
   the CompositeControl by comparing the EventName and property name
* For each control returned from GetContents, we enumerate its
   command bindings and compare them to the command
   bindings found on the CompositeControl.
* If a matching command binding is found, we clone its postback
   handlers onto the child control. EventName is adjusted to
   match the new property name

The control enumeration is done recursively before adding the
control to Children, thus walking only through the tree created in
this CompositeControl - nested CompositeControls,
initialized Repeaters, ... are not included.

In order to support templatws created in the CompositeControl,
we recurse into CloneTemplates. For DelegateTemplate or any
other more advanced needs, a protected
CopyPostBackHandlersRecursive method is provided.

resolves #1699
@tomasherceg tomasherceg merged commit 7cc1ad7 into main Sep 29, 2023
14 checks passed
@tomasherceg tomasherceg deleted the compositecontrol-postback-handlers branch September 29, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Postback handlers does not work in composite controls
2 participants