We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ShowAddNewRow and Enums

Hi,

In the show AddNewRow, I have a cell which type is an enum "MyEnum" and I'd like the user to be able to choose an enum value in the cell. So is it possible by doing this?

lstNotes.VisibleColumns[2].ColumnStyle.ItemsSource = Enum.GetValues(typeof(NoteDestinationTypeEnum));

Is it supported by GridDataControl? Actuallyu when I fill the three cells, there is no item created.

Thanks!

AutoPopulateRelations="False"
VisualStyle="DefaultOffice2007Blue"
ItemsSource="{Binding Source={StaticResource allNotes}, Path=Notes}">













1 Reply

MS Mohamed Suhaib Fahad A. Syncfusion Team February 11, 2010 12:11 PM UTC

Hi Francois,

Use the Model.QueryCellInfo event handler to change the CellType for the AddNewRow,

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
var gridStyle = e.Style as GridDataStyleInfo;
if (gridStyle.CellIdentity.TableCellType == GridDataTableCellType.AddNewRecordCell)
{
if (gridStyle.CellIdentity.Column != null && gridStyle.CellIdentity.Column.MappingName == "CustomerID")
{
gridStyle.CellType = "ComboBox";
e.Handled = true;
}
}
}

The VisibleColumn.ColumnStyle only applies to the Record cells. AddNewRow may require a separate property like AddNewRowStyle, Please let us know if you need any more details.

-Fahad

Loader.
Live Chat Icon For mobile
Up arrow icon