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.
Syncfusion Feedback

Disabling other cell based on value of current cell

Thread ID:

Created:

Updated:

Platform:

Replies:

52928 Dec 6,2006 06:03 AM UTC Dec 11,2006 02:42 PM UTC Windows Forms 7
loading
Tags: Grouping
Pawan Adur
Asked On December 6, 2006 06:03 AM UTC

Hi haneef ,
thanx for the example,but my requirement is some what different.

I need to disable a cell in GridGroupingControl based on some condition which will occur in some other cell.
if i use gridGroupingControl1_QueryCellStyleInfo,
in eventArgs i get the current cell info and i can disable the current selected cell.
but i need to disable some other cell based on the value of current cell.

Pawan Adur
Replied On December 6, 2006 11:00 AM UTC

hi haneef,
can u plz guide for this.

>Hi haneef ,
thanx for the example,but my requirement is some what different.

I need to disable a cell in GridGroupingControl based on some condition which will occur in some other cell.
if i use gridGroupingControl1_QueryCellStyleInfo,
in eventArgs i get the current cell info and i can disable the current selected cell.
but i need to disable some other cell based on the value of current cell.

Administrator [Syncfusion]
Replied On December 6, 2006 11:37 AM UTC

Hi Pawan,

Here is a forum thread that discuss with a simillar issue.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=52631

Best Regards,
Haneef

Pawan Adur
Replied On December 6, 2006 12:28 PM UTC


Hi haneef,
i have essential studio 3.3.0 , so cannot refer to the example given there.
>Hi Pawan,


Here is a forum thread that discuss with a simillar issue.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=52631

Best Regards,
Haneef

Pawan Adur
Replied On December 6, 2006 01:35 PM UTC

Hi haneef,
i went thru the example. but color applies to whole row and not a single cell.how to do it for single cell.

thanx
pawan

>
Hi haneef,
i have essential studio 3.3.0 , so cannot refer to the example given there.
>Hi Pawan,


Here is a forum thread that discuss with a simillar issue.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=52631

Best Regards,
Haneef

Pawan Adur
Replied On December 11, 2006 07:57 AM UTC

Hi haneef,
that solution didnt solve my query .
plz help
Thanx
pawan

>Hi haneef,
i went thru the example. but color applies to whole row and not a single cell.how to do it for single cell.

thanx
pawan

>
Hi haneef,
i have essential studio 3.3.0 , so cannot refer to the example given there.
>Hi Pawan,


Here is a forum thread that discuss with a simillar issue.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=52631

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On December 11, 2006 09:14 AM UTC

Hi Pawan,

Here is a minimal sample that shows you how to set the style property of the cell such as Enabled,Clikable,BackColor and etc,.depends on the another cell value in a same row. It implements the TableControlPrepareViewStyleInfo event to change the Enabled/BackColor property of the cell by checking the EmpName is equal to "Hazart" in a "Salary" column cell. Here is a code snippet

private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo info = e.Inner.Style as GridTableCellStyleInfo;
Element el = info.TableCellIdentity.DisplayElement;
if( el != null && el.Kind == DisplayElementKind.Record)
{
GridRecordRow row = el as GridRecordRow;
if( row != null && row.ParentRecord != null && info.TableCellIdentity.Column != null )
{
//Disable the Salary Column depends on the value present the EmpName column.
//Check the Cell value depends on the "Salary" Column...
if( info.TableCellIdentity.Column.Name == "Salary")
{
//Access the "EmpName" cell value.
object obj = row.ParentRecord.GetValue("EmpName");
if( obj != null && obj.ToString() == "Hazart")
{
e.Inner.Style.Enabled = false;
e.Inner.Style.Clickable = false;
e.Inner.Style.BackColor = SystemColors.Control;
}
}
}
}
}

Please refer to the attached sample for implementation.
GGCCellEnabledProperty.zip

Best Regards,
Haneef

Pawan Adur
Replied On December 11, 2006 02:42 PM UTC


Hi haneef,
thanx for the example. i did that but the usage TableControlPrepareViewStyleInfo is just too costly it seems that grid takes lot of time to repaint . as i am disabling
cells based on other cells value.
Also in the drop down some times the TableControlCurrentCellChanged event is caught but some times the event is not caught.
can i do this in TableControlCurrentCellChanged only.


>Hi Pawan,

Here is a minimal sample that shows you how to set the style property of the cell such as Enabled,Clikable,BackColor and etc,.depends on the another cell value in a same row. It implements the TableControlPrepareViewStyleInfo event to change the Enabled/BackColor property of the cell by checking the EmpName is equal to "Hazart" in a "Salary" column cell. Here is a code snippet

private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo info = e.Inner.Style as GridTableCellStyleInfo;
Element el = info.TableCellIdentity.DisplayElement;
if( el != null && el.Kind == DisplayElementKind.Record)
{
GridRecordRow row = el as GridRecordRow;
if( row != null && row.ParentRecord != null && info.TableCellIdentity.Column != null )
{
//Disable the Salary Column depends on the value present the EmpName column.
//Check the Cell value depends on the "Salary" Column...
if( info.TableCellIdentity.Column.Name == "Salary")
{
//Access the "EmpName" cell value.
object obj = row.ParentRecord.GetValue("EmpName");
if( obj != null && obj.ToString() == "Hazart")
{
e.Inner.Style.Enabled = false;
e.Inner.Style.Clickable = false;
e.Inner.Style.BackColor = SystemColors.Control;
}
}
}
}
}

Please refer to the attached sample for implementation.
GGCCellEnabledProperty.zip

Best Regards,
Haneef

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

;