We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamically calculating a value in a databound grid

Thread ID:

Created:

Updated:

Platform:

Replies:

26969 Apr 4,2005 06:59 PM UTC Apr 6,2005 02:02 PM UTC WinForms 3
loading
Tags: GridControl
Helmut
Asked On April 4, 2005 06:59 PM UTC

Hello, I have a master-detail grid form. In the detail grid, there are two columns, QtyPer and UnitQty. The product of these values is QtyReq. Here''s what I would like to do: Whenever the user changes the values of QtyPer or UnitQty, I''d like to recalculate the value of QtyReq and refresh it in its cell. How do I do this? Thank you.

Administrator [Syncfusion]
Replied On April 4, 2005 07:51 PM UTC

Is QtyReq an Expression column in your DataTable? That would be the simplest way to do it. Otherwise, you could try handling an event like CurrentCellAcceptedChanges and if grid.Currentcell.ColIndex points to one of the first two columns, reset the value in the QtyReq column.

Helmut
Replied On April 6, 2005 01:08 PM UTC

I''m not sure how to set an expression column. However, what is the syntax to set the value of the QtyReq cell of the current row? Thank you. >Is QtyReq an Expression column in your DataTable? That would be the simplest way to do it. > >Otherwise, you could try handling an event like CurrentCellAcceptedChanges and if grid.Currentcell.ColIndex points to one of the first two columns, reset the value in the QtyReq column.

Administrator [Syncfusion]
Replied On April 6, 2005 02:02 PM UTC

One way to do it is to use the CurrencyManager to access the underlying DataRowView and set the value there. CurrencyManager cm = (CurrencyManager)grid.BindingContext[grid.DataSource, grid.DataMember]; DataView dv = (DataView) cm.List; DataRowView drv = (DataRowView) cm.Current; drv["Qty"] = ???? But if you want to use an expression column, here is a sample. http://www.syncfusion.com/Support/user/uploads/GDBG_masterdetails_9a42cfe0.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;