I have create a griview on runtime, i need to set default value for a column combobox, to set default value for combobox correct i need to ChangeType of default value to comun tager type. I am using workaround in this post https://www.devexpress.com/Support/Center/Question/Details/Q355125/aspxgridview-how-to-determine-a-data-type-of-gridviewdatacolumn-at-runtime but if datagrid with empty row it return nothing.
How can i get tager column type in runtime
ASPxGridView - How to determine the column type is there is no data
Answers approved by DevExpress Support
Hello,
This behavior is expected. If ASPxGridView is bound to an empty data source, it knows nothing about the data source's value types. Therefore, it cannot generate corresponding columns for these types. So, I see two possible solutions here:
- Manually add all columns to the grid's Columns collection in the ASPxGridView.DataBinding event handler.
- In the ASPxGridView.DataBinding event handler, call the ForceDataRowType method as recommended in the ASPxGridView - How to use ForceDataRowType method ticket.
Thanks,
Stanley