Hi,
I am new to Infragistics Grid. I have following basic questions. My grid is not bound design time. It will display search results based on user selection in Search form. I bind it using grid.datasource = mydatasourceTable.
1. How can I hide some of the columns I am pulling in my datasource table?
2. How can I convert cells of one column into checkboxes?
3. How can I change column headings for this column?
This is a single band grid and no hierarchical data. Will appreciate any suggestions you may have.
thank you,
Yogesh
1. Handle InitializeLayout and set the Hidden property on the columns you don't want to present to the user:
private void ultraGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e){ ColumnsCollection columns = e.Layout.Bands[0].Columns; foreach( UltraGridColumn column in columns ) { string columnKey = column.Key;
switch ( columnKey ) { // Hide the column case "Whatever": column.Hidden = true; break; } }}
2. If the data is boolean, the column will automatically select a CheckEditor as the default embeddable editor/renderer for the column, so in that case you don't have to do anything. If the data is not convertible to boolean, you can use a data filter, and demonstrated in this KB article.
3. You can also use InitializeLayout for this, as demonstrated by the code in #1. In this case, you would set the UltraGridColumn.Header.Caption property.
Thanks Brian,
That helped. One more quicky. How can I order the columns in my code. Let's say I want to move column # 4 to column # 1, how can I do that?
thanks,