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

ReadOnly Currency Cell

Hi ,

I am using gridcontrol in virtual mode. How to make a cell using CurrencyEidt but is read only, not editable?

Try the following, but it does not work.

e.Style.CellType = GridCellTypeName.Currency;
e.Style.ReadOnly = true;

Thanks,

Q


2 Replies

QS Qingde Shi February 23, 2011 07:33 PM UTC

To make it clearer, when clicking the currency cell, it apprears it changed to editting mode (format and symbol removed), but can not enter value, so it is readonly. but the question is how to make it appears static, clicking the cell does not change its currency format?

Thanks,

Q



MA Mahendran Syncfusion Team March 3, 2011 01:47 PM UTC

Hi Qingde,

Thanks for your interest in Syncfusion products.

You can set the Currency symbol when the cell type as Currency and ReadOnly.You need to handle the CurrentCellStartEditing event handler with respective code. The following code explains the same.


this.gridControl1.CurrentCellStartEditing += new CancelEventHandler(gridControl1_CurrentCellStartEditing);
void gridControl1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
if (cc.Renderer is GridCurrencyTextBoxCellRenderer && cc.Renderer.StyleInfo.ReadOnly)
{
e.Cancel = true;
}
}


Please let us know if you ave any concerns.

Regards,
R.Mahendran


Loader.
Live Chat Icon For mobile
Up arrow icon