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.
Unfortunately, activation email could not send to your email. Please try again.

GDBG, ReadOnly Cells and New Cells

Thread ID:

Created:

Updated:

Platform:

Replies:

73978 May 27,2008 03:57 PM May 28,2008 08:04 AM Windows Forms 1
loading
Tags: GridControl
Stacey Upsonnolongercoding.NET
Asked On May 27, 2008 03:57 PM

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.




Administrator [Syncfusion]
Replied On May 28, 2008 08:04 AM

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;
}

}



CONFIRMATION

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.

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.

;