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.
Microsoft has ended support for older versions of IE. For the best experience, upgrade to the latest version of IE, or view this page in another browser.
How to avoid selecting a particular column in GridDataControl?
GridDataControl allows you to select single or multiple records based on the value specified for the ListBoxSelectionMode property. By default GridDataControl does not avoids selecting any column, however you can achieve it in a different way. UsingQueryCellInfoevent youcan able to get the index of the column(s) that you want to avoid selection. By setting the e.Style.Enable property asto‘false’ for that column(s), you can deactivate the cells belonging to that column from being current cell. Thus you cannot select or edit that column.
Following code snippet exampledemonstrates how to avoid selection ofthe column with mapping name “EmpName”.
C#
Here the index of the column with MappingName “EmpName” in the DataGrid is obtained in the variable index. Using this index the current position of that column in the view is resolved using the method ResolveVisiblecolumnIndexToPosition. This allows you to locate that column in cases such as grouping and when row header is enabled. Thus you can disable the selection of that column using the obtained resolvedIndex.
Did you find this information helpful?
Help us improve!
Correct inaccurate or outdated content
Improve illustrations or images
Fix typos or broken links/images
Add more information
Correct inaccurate or outdated code samples
I agree to the creation of a Syncfusion account in my name and to be contacted regarding this message. No further action will be taken. Please see our Privacy policy and Cookie Policy.
This page will automatically be redirected to the sign-in page in 10 seconds.
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.