Ticket T810926
Visible to All Users

ASPxGridView - How to determine the column type is there is no data

created 6 years ago

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

Answers approved by DevExpress Support

created 6 years ago

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:

  1. Manually add all columns to the grid's Columns collection in the ASPxGridView.DataBinding event handler.
  2. In the ASPxGridView.DataBinding event handler, call the ForceDataRowType method as recommended in the ASPxGridView - How to use ForceDataRowType method ticket.

Thanks,
Stanley

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.