Getting Data from a Dynamic Module
Hi All,
I'm currently writing some code to tie into the dynamic content creating event which is working fine and is pasted below. Essentially it creates a role for each piece of dynamic content (its going to be eventually tied to ecommerce). What I'd like to do is after creating the role go ahead and create the ecommerce product however I'm having trouble getting the actual data of the dynamic model object (name, description, price). Any ideas on the proper way to go about doing this?
public
void
CourseEventsHandler(IDynamicContentCreatedEvent eventInfo)
var dynamicContentItem = eventInfo.Item;
var role = Convert.ToString(dynamicContentItem.UrlName);
CreateRole(role);
Thanks!
Jason
Hey Jason,
I understand you need the properties of the DynamicContent Item? You can just use the extension methods GetValue or GetValue<T>. They are living in the Telerik.Sitefinity.Model namespace.
public
void
CourseEventsHandler(IDynamicContentCreatedEvent eventInfo)
var dynamicContentItem = eventInfo.Item;
var role = Convert.ToString(dynamicContentItem.UrlName);
CreateRole(role);
// Get the data out of the DynamicContentItem
var title = dynamicContentItem.GetValue(
"Title"
).ToString();
Kind regards,
Daniel
Thanks! I knew I was doing something stupid. Completely forgot that namespace.