Ticket Q329483
Visible to All Users

How to prevent LookUpEdit from allowing a null value through

created 14 years ago

I have a grid that is bound to an XPCollection for my main object. The grid displays two items a sequence number and a reference to another object (Assessment Type). The assessment type is lookedup via a LookUpEdit control but whilst I have AllowNullInput set to False the initial value is a null when the user has clicked the '+' on the grid to add a record. I don't want this to be saved to the database which is what happens if they don't edit this field.
How can I either automatically prevent the null value being saved or intercept the save process and cancel it if no selection has taken place (how do I test for a null here in VB.NET?) that would prevent the situation arising which is causing difficulty - either that or I could take the users out and shoot them.

Comments (1)
DevExpress Support Team 14 years ago

    Hi Steve,
    If you add a new row via GridView, you can handle the InitNewRow event and set a value to a column where LookupEdit is assigned. This will prevent the null value from being saved into a datasource.
    Thanks,
    Ted

    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.