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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I hide particular checkboxes in a datagrid column?

Thread ID:




9306 Dec 12,2003 06:57 PM UTC WinForms 0
Tags: FAQ
Asked On December 12, 2003 06:57 PM UTC

Hi, I have a DataGrid bound to a table with 5 columns and 20 rows. Out of 5 columns, the first one is of custom type public class DataGridCheckBoxColumn : DataGridBoolColumn {}; the rest 4 columns are of type DataGridTextBoxColumn. My first column needs to be able to hide checkboxes based on the rowNum. I was able to make them uneditable by overriding the Edit()method, but how do I make them invisible? I tried overriding Paint() method, but it didn't work for me: protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight) { if (rowNum == 1) { Brush bgBrush = new SolidBrush(this.DataGridTableStyle.BackColor); Brush fgBrush = new SolidBrush(this.DataGridTableStyle.ForeColor); g.FillRectangle (bgBrush, bounds); } else base.Paint(g, bounds, source, rowNum, alignToRight); } I would appreciate any suggestions on how I might be able to hide/make invisible certain checkboxes. Thanks so much! Natalia


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