ActiveDatabaseSoftware.ActiveQueryBuilder.Web.Control Namespace > QueryBuilderControl Class : CustomizeDatasourceControlFieldList Event |
'Declaration Public Event CustomizeDatasourceControlFieldList As CustomizeDatasourceFieldListEventHandler
'Usage Dim instance As QueryBuilderControl Dim handler As CustomizeDatasourceFieldListEventHandler AddHandler instance.CustomizeDatasourceControlFieldList, handler
public event CustomizeDatasourceFieldListEventHandler CustomizeDatasourceControlFieldList
public: __event CustomizeDatasourceFieldListEventHandler* CustomizeDatasourceControlFieldList
CustomizeDatasourceControlFieldList event allows to sort fields within the list or remove unwanted fields from the list.
This event differs from the CustomizeDatasourceFieldList Event in that it's fired more frequently, but only after the SQL parsing is complete, so you can examine the QueryBuilder.QueryStatistics collections and other internal query structure objects in this event's handler.
The field list to be customized is passed through the fieldList parameter.
The datasource parameter refers to the DataSource being added to the Design Area.
protected void QueryBuilderControl1_CustomizeDatasourceFieldList(QueryBuilder queryBuilder, DataSource datasource, MetadataFieldList fieldList) { if (datasource.MetadataObject == null) return; for (int i = fieldList.Count - 1; i > 0; i--) { bool found = false; for (int j = 0; j < queryBuilder.QueryStatistics.UsedDatabaseObjectColumns.Count; j++) if (datasource.MetadataObject.NameStr == queryBuilder.QueryStatistics.UsedDatabaseObjectColumns[j].ObjectName.Token && fieldList[i].NameStr == queryBuilder.QueryStatistics.UsedDatabaseObjectColumns[j].Name.QualifiedName) { found = true; break; } if (!found) fieldList.Delete(i); } }