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

GridData - how to dynamically show/hide or enable cells per row?

Thread ID:

Created:

Updated:

Platform:

Replies:

105654 Nov 9,2012 07:48 AM UTC Dec 5,2012 11:44 AM UTC WPF 1
loading
Tags: GridControl
Walter Pindhofer
Asked On November 9, 2012 07:48 AM UTC

Hallo,

I have created a GridDataControl where each row consist of several cells containing regular text fields and check boxes that can be edited by the user.

Now, for some rows, depending on the contained data, one of the check boxes is not applicable, so I would like to either hide it (show an empty cell) or at least disable it on these rows. What is the best way to achieve this?

Thanks for your help!
Walter

Kannan R [Syncfusion]
Replied On December 5, 2012 11:44 AM UTC

Hi Walter,

 

Thanks for using Syncfusion products.

 

We have analyzed your query with our sample and your requirement can be achieved by handling QueryCellInfo event, please find below code snippet to achieve your requirement.

 

Code Snippet[C#]:

 

  
 
 void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

        {

 

            if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex == 1)

            {

                if (e.Style.CellValue == "true" || e.Style.CellValue == "false")

                {

                    e.Style.CellType = "CheckBox"// Setting celltype as checkbox

                    e.Style.IsThreeState = false;

                }

                else

                {

                    e.Style.Enabled = false;   //To Disable the cell.

                    e.Style.CellValue = "";      //To display as empty cell.

                }

 

            }

 

        }

 

 

 

We have also prepared sample based on your requirement and it can be downloaded from below location.

Sample Location:  105654ForumSample.zip

Please let us know if you have any queries.

 

Thanks,

Kannan.R


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

;