The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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?
ADAdministrator Syncfusion Team 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