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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Enable/disable adjacent cell based on checkbox value

Thread ID:

Created:

Updated:

Platform:

Replies:

142062 Jan 17,2019 05:23 AM UTC Jan 18,2019 04:41 AM UTC WinForms 3
loading
Tags: GridGroupingControl
Mariusz Juszkiewicz
Asked On January 17, 2019 05:23 AM UTC

How to Enable/disable adjacent cell based on checkbox value. I have a clolumn with checkboxes and Mothcaleder column just beside it.
What I want is when the checkbox is not check for month calendar cell on the same roe to be disabled/read only etc. When user checks the checkbox I want the calendar cell beside to be enabled/full write etc.
Mariusz


Arulraj A [Syncfusion]
Replied On January 17, 2019 07:20 AM UTC

Hi Mariusz, 

Thanks for using Syncfusion product. 

To make the cell as read only based on another cell value in the same row, you could use the Style.Enabled property in QueryCellStyleInfo event. Please refer the following code example. 

C# 
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo; 
 
 
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
    if (e.TableCellIdentity == null || e.TableCellIdentity.Column == null) 
        return; 
 
    if (e.TableCellIdentity.Column.Name == "Date" && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) 
    { 
        Record record = e.TableCellIdentity.DisplayElement.GetRecord(); 
        if (record != null) 
        { 
            var value = record.GetValue("Boolean"); 
            if (value != null) 
            { 
                int v; 
                if (int.TryParse(value.ToString(), out v) && v <= 0) 
                    e.Style.Enabled = false; 
            } 
        } 
    } 
} 
 
 
Arulraj A 


Mariusz Juszkiewicz
Replied On January 18, 2019 03:35 AM UTC

Arulraj Thank you,

if (int.TryParse(value.ToString(), out v) && v <= 0)
was giving me trouble in my application. I have used
if (!Convert.ToBoolean(value.ToString()))
it seems to work.

Arulraj A [Syncfusion]
Replied On January 18, 2019 04:41 AM UTC

Hi Mariusz,

Thanks for the update.

Please feel free to contact us in case of any further difficulty. We'll be glad to assist you.

Regards,
Arulraj A

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon