Templates base controlsCancel

I think it would be helpful if, isntead of inheriting from UserControl, the generic content templates (newsmasterview, newsdetailsview, eventsmasterview, etc) would inherit from something like ContentViewControl, where each control would have a strongly-typed propery that holds the contentitem in question.

For example, if I'm on the newsview, and want to retrieve properties from the newsitem, I have to call the NewsManager and retrieve this item again. This is redundant, because the control already has this item, as it's using it to populate the page. However, it's not accessible at the page level.

It would be great if we could be in the NewsView and do something like

MyCustomLabel.Text = this.ContentItem.GetMetaData("MyCustomField")

where ContentItem is the IContent item retrieved when the control is initialized.

I hope that this makes sense, and if such feature is already present, please point it out to me as this would save me tons of time!

thanks for your reply! but it looks like this is at the contentview control level. I don't want to change that file because then I'll have to register my overridden control.

what I'm referring to is the usercontrol templates that are used to layout the control. currently, these are regular user controls, with no embedded, strongly typed property to reference the contentview.

I think I could inherit from UserControl and add a property that does something like

but it would be better if this was automatically part of the system, so that whenever I map to a user control, i map to a usercontrol of type IContentUsercontrol or something similar that already includes this property.

The behavior you see in the moment is pretty much depending on the ORM used. With Nolics and this architecture, you should start a new transaction every time you want to get an item. Otherwise you will get the familiar object not in transaction error. The transaction ends right after we show the item together with its meta fields.

In Sitefinity 4.0 the approach would be rather different though. We are focused on the performance and strengthening the API. In the upcoming version for example, there will be a case in which even the transactions will be kept in cache as well as the database write operations, so this will allow a huge lower with minimum database operations. Back to the question - the work with the managers will be completely different, and you will not need to take the items again. We will think for your suggestion as well, and provide an easier access to the content.

Webinars

Tools

Progress, Telerik, Sitefinity and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.