Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > No duplicate bookingEvents in cmsgrid - How? View modes: 
User avatar
Member
Member
vjmdev - 11/29/2010 3:23:01 PM
   
No duplicate bookingEvents in cmsgrid - How?
Hi, I'm using a cmsdatagrid where I'd like to show bookingEvents although I do not want any duplicate. My bookingEvents can have the same EventName because in my case they represent trainings tha can be held in different dates/location but they have the same title.

How can I do that? I tried to put "distinct EventName" in Selected Columns property of the cmsdatagrid webpart but it didn't work..

Thanks a lot.

User avatar
Member
Member
kentico_michal - 11/30/2010 8:40:11 AM
   
RE:No duplicate bookingEvents in cmsgrid - How?
Hi,

Regrettably, Selected columns property does not accept DISTINCT parameter. I would recommend you consider creating your own query that would return only non-duplicated bookingsEvents. You could use ExecuteQuery method to execute the query and returned dataset may be used as a DataSource property of CMSDataGrid control

GeneralConnection conn = ConnectionHelper.GetConnection();
DataSet set = null;
set = conn.ExecuteQuery("cms.BookingEvent.customquery", parameters);
CMSDataGrid.DataSource = set;
CMSDataGrid.DataBind();


More information about Kentico API can be found in API reference

Best regards,
Michal Legen