Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > IList and K# syntax View modes: 
User avatar
Member
Member
Brian.Kellogg-VinSolutions - 10/30/2012 4:26:33 PM
   
IList and K# syntax
I'm trying to pass an IList object into a macro, and use K# to get the data out of it. Is this possible?

http://devnet.kentico.com/docs/devguide/index.html?registering_cutom_macro_methods.htm

This document states this:

K# supports indexing. The following is a list of indexable objects:

•DataRow, DataRowView, DataRowContainer (returns value at given index)
•DataTableContainer (returns row at given index)
•DataSetContainer (returns table at given index)
•String (returns char at given index)
•IList
•IEnumerable

And this document http://devnet.kentico.com/docs/devguide/index.html?registering_cutom_macro_methods.htm states these two methods:

Object GetValue(ISimpleDataContainer container, String column)
Gets value of the specified column from the object.
ISimpleDataContainer container: Data container.
String column: Column name.

Object GetProperty(IHierarchicalObject collection, String property)
Gets value of the specified property from the object.
IHierarchicalObject collection: DataContainer.
String property: Property name.

That I was hoping would allow me to get the data out, but those two don't work.

Any suggestions?

User avatar
Member
Member
Brian.Kellogg-VinSolutions - 10/30/2012 5:00:22 PM
   
RE:IList and K# syntax
I'm sorry..

The first article should be http://devnet.kentico.com/docs/devguide/ksharp_syntax.htm

Second should be http://devnet.kentico.com/docs/devguide/available_macro_methods.htm

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/2/2012 2:24:01 AM
   
RE:IList and K# syntax
Hi,

You haven't replied to the ticket message sdo I guess you have figured it out :-) (if not, please let me know).
So, I will post it here just for reference.

The syntax is the same as in C# - e.g. when using IEnumerable (this implements the IList). You can use it as a cycle or "classic" indexer [].

Best regards,
Juraj Ondrus