Ticket T1285900
Visible to All Users

Binding to object from selected row of gridview

created 6 days ago

Hello,

Is it possible to databind the object that is represented by a single selected row from a gridview. We have some editors outside the grid that should be populated by values of the object selected.

Previously we have handled this manually by handling the FocusedRowChanged event from the gridview, but we were wondering if it's possible to do so automatically with data binding? There does not seem to be any relevant attributes on the GridControl though, so we are unsure.

Thank you

Answers approved by DevExpress Support

created 3 days ago

Hello,

Yes, it is possible. To do this, bind an editor's property to the grid's data source object along with the corresponding property of the data object.

For example:

C#
// DataBindings.Add("EditorProperty", GridControl.DataSource, "DataObjectProperty") textEdit1.DataBindings.Add("Text", gridControl1.DataSource, "FirstName");

I hope this helps. Should you have additional questions, please let me know.

    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.