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

TemplateHost control #1109

Merged
merged 6 commits into from Sep 5, 2021
Merged

TemplateHost control #1109

merged 6 commits into from Sep 5, 2021

Conversation

tomasherceg
Copy link
Member

When working on #535, we found that it will be useful to have a TemplateHost control.

I've put it in a separate PR and added some UI tests - the control can be used to pass templates in markup controls.

@quigamdev quigamdev changed the base branch from v4-main to main August 27, 2021 16:43


protected internal override void OnLoad(IDotvvmRequestContext context)
{
ContentTemplate?.BuildContent(context, this);
var placeHolder = new PlaceHolder();
Template.BuildContent(context, placeHolder);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nullable types should complain somewhere here, please add a simple nullcheck to avoid NRE when users forgets to set the property.

Suggested change
Template.BuildContent(context, placeHolder);
Template.NotNull("TemplateHost.Template is required").BuildContent(context, placeHolder);

Also, I think it would be convenient to add a constructor overload with template as parameter. Maybe we could also add overload to the AppendChildren(ITemplate) helper method that would automatically create this control.

@tomasherceg tomasherceg merged commit 7687ff4 into main Sep 5, 2021
@tomasherceg tomasherceg deleted the feature/template-host branch September 5, 2021 08:43
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.

None yet

2 participants