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.
Unfortunately, activation email could not send to your email. Please try again.

Updating values in cells when grid load

Thread ID:

Created:

Updated:

Platform:

Replies:

92467 Jan 17,2010 04:17 AM Jan 19,2010 12:25 AM Windows Forms 3
loading
Tags: GridControl
Ruslan Gasanbekov
Asked On January 17, 2010 04:17 AM

Hi,

I would like to update some values in some cells when the grid is loading.
I'm using QueryCellStyleInfo event for this.
the problem is that after I change some values in the grid the event is raised again.
I would like to prevent this behavior.
Is there any other event beside QueryCellStyleInfo which raised for each cell and do it only once, or any work around for QueryCellStyleInfo event?

here is my current code:

private void gridGrpCtrlAssignEmps_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.Column != null)
{
GridGroupingControl gridGroupingControl = sender as GridGroupingControl;
Element gridElement = gridGroupingControl.Table.DisplayElements[e.TableCellIdentity.RowIndex];
Record gridRecord = gridElement.GetRecord();
//DataRowView recordDataSourceView = gridRecord.GetData() as DataRowView;

if (gridRecord != null)
{
BLActualWorkAttendance attandance = gridRecord.GetData() as BLActualWorkAttendance;
if (attandance != null)
{
if (e.TableCellIdentity.Column != null)
{

if (e.TableCellIdentity.Column.Name == this.m_Dictionary["SignIn"])
{
if (attandance.SignIn == null)
{
//if signIn is empty, call automatic insertion of sign in and actual in
//SET RECORD VALUES LIKE GridRecord.SetValue("SignIn", VALUE);
e.Handled = true;
}
}
}
}
}
}
}


Jisha Joy [Syncfusion]
Replied On January 18, 2010 04:52 AM

Hi Ruslan,

The event QueryCellStyleInfo will fire continuously for any reason such as querying a cell, mousemove, mouseover. And we cannot avoid this. To monitor the cell value changed and set a column value in that record, the Table.RecordValueChanged event will be the best one.

Please let me know if you have any questions.

Regards,
Jisha

Ruslan Gasanbekov
Replied On January 18, 2010 08:27 AM

RecordValueChanged event wouldn't help me in this case.

I would like to go over the grid rows before it displayed on the first time, check some cells values and change the values in some conditions and only one time, before the grid is first loaded.

RecordValueChanged is raised only after the grid had already been loaded and displayed, and only when I change some cells values manually.

Jisha Joy [Syncfusion]
Replied On January 19, 2010 12:25 AM

Hi Ruslan,

Here is a forum thread discussing this and it had a sample showing QueryCellInfo only being hit once.

http://www.syncfusion.com/support/forums/grid-windows/24997

You might also see the SingleQueryCellInfo technique from our sample "OTO Query Cell Info Demo" where QueryCellInfo is only hit once.

C:\Documents and Settings\[Username]\My Documents\syncfusion\essentialstudio\7.4.0.20\Windows\Grid.Windows\Samples\2.0\Performance\OTO Query Cell Info Demo\cs

Please let me know if you have any further queries.

Regards,
Jisha

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.

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.

;