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

ReadOnly in GridDataBoundGrid

Thread ID:





21510 Nov 12,2004 01:16 PM UTC Nov 12,2004 01:59 PM UTC WinForms 1
Tags: GridControl
Asked On November 12, 2004 01:16 PM UTC

I have a GridDataBoundGrid, I set grid.Model.ReadOnly = true when I initialize the grid because I don''t allow user to edit for most of the columns. However in some cells, I do need user input based on those cells'' values. So I need to set those cells'' ReadOnly property false. What I did is: for(int i = 0; i < grid.Model.RowCount; i++) { if (resultTable.Rows[i][2].Equals((object)true)) { grid.Model.IgnoreReadOnly = true; grid[i, 2].ReadOnly = false; grid.Model.IgnoreReadOnly = false; } } Above code doesn''t work. All of the grid is still ReadOnly. Any suggestion?

Administrator [Syncfusion]
Replied On November 12, 2004 01:59 PM UTC

If you want a whole column to not be ReadOnly, then you can set the GridBoundColumn.ReadOnly = false for that column using either the grid.GridBoundColumns (if you populated this collection) or grid.Binder.InternalColumns (if you did not populate the grid.GridBoundColumns collection). But if you want to set a property (other than style.CellValue or style.Text) only on some cells in a column, then you have to do it dynamically handling an event through either grid.PrepareViewStyleInfo or grid.model.QueryCellInfo. You use PrepareViewStyleInfo for properties used in drawing the cell like style.BackColor. You need to use Model.QueryCellInfo for functional properties like ReadOnly. Here are two KBs on this process. The second one shows how to use Model.QueryCellInfo to set ReadOnly = true for a cell. You could set it to false that way as well. http://www.syncfusion.com/Support/article.aspx?id=560 http://www.syncfusion.com/Support/article.aspx?id=10351


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