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
close icon

GDBG, ReadOnly Cells and New Cells

I have a GDBG that uses a dataset as it's source. When the grid is displayed, I need all of the data to be locked down from editing. They can navigate using arrow keys, but no editing can be allowed.

However, once they hit an "Add" button, a new row needs to appear at the bottom of the grid and the user needs to be allowed to enter data.

I've been able to get most everything figured out except the part about having the user allowed to enter data.

The current method I'm using for locking down the grid is to set the columns to ReadOnly when the grid is first displayed. I have set the IgnoreReadOnly property to True for the gdbg.model, but when I try and set the cell's ReadOnly property to False, I still cannot enter data in any of the new cells.

Any help would be great.

thanks.




1 Reply

AD Administrator Syncfusion Team May 28, 2008 12:04 PM UTC

One way you can try to do this is to set the ReadOnly property on the style in grid.Model.QueryCellInfo.


//subscribe to the event.... gridDataBoundGrid1.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);


//the event handler
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.RowIndex == gridDataBoundGrid1.Model.RowCount ||
(e.RowIndex == gridDataBoundGrid1.Model.RowCount - 1 && gridDataBoundGrid1.Binder.IsAddNew))
{
e.Style.ReadOnly = false;
}
else
{
e.Style.ReadOnly = true;
}

}



Loader.
Live Chat Icon For mobile
Up arrow icon