Hi,
Sorry to bug you with such simple case but I can't make a grid work in a quite simple case.
- My grid is bound to a list of simple object instances (3 properties : Id (int), Name (string), Duplicable (boolean))
- I have an edit template in which I have 3 controls : a textbox, a checkbox, an upload control
- If I click "add new" choose values, and click update I have troubles
I made two examples I attached in a sample project :
- The first one "Default.aspx", is using the default asp.net <%# Bind("PropertyName") %>. It crashes on the boolean property "Duplicable" when clicking on the update button
- The second one "Default2.aspx", is not using Bind method, but is attached to controls Init event, but in this case, I'm loosing values when clicking on update. Like if they were not read back from viewstate.
Please help, I feel a bit shamy because I can't get what I'm doing wrong in such a simple case.
Regards,
Pierre
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.
Hello Pierre,
Thank you for your application. I have examined it and found out that you bind editors properties that do not support NULL objects. In fact, when you click the New button, the grid does not have a data item on the edit form. Thus, all properties have null values.
The ASPxCheckBox.Checked property is of the Boolean type, and it cannot accept null values. However, each editor has the ASPxEdit.Value property, which works fine. If you use it, you will not get the exception.
Just in case, I have attached the modified sample.
Thanks,
Vest
Thank you Vest,
But it seems it's not better, in the example you gave back now I get this error :
"DataBinding: 'DevExpress.Web.Data.WebDataRow' does not contain a property with the name 'Name'."
How can this happen ?
Hello Pierre,
Thank you for your response.
I have investigated the issue and found out that you assign a datasource and bind the grid with it in the page Load event handler. In some cases it is too late. For example when an edit form is opened and you insert data the grid is bound before the page Load event fires. That is why you see the exception.
See the The general technique of using the Init/Load event handler for additional information.
I have moved grid data binding to the grid DataBinding event handler. After that the project works properly. Please see the attached video.
If you have any other questions, you are welcome to contact us at any time.
Best regards,
Vladimir
Thank you very much Vlad.