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

Refreshing the cell

Hi,
I have a custom cell renderer which subscribes to some events and in the handler I need to refresh the cell. I do the following to add the handlers
GenNextDateOrTenorModel dtmodel = (GenNextDateOrTenorModel) model;
SyncDatePickerCellRenderer r = (SyncDatePickerCellRenderer)this.m_Grid.CellRenderers["SyncDatePickerCell"];
dtmodel.BaseCCYChanged += new CCYChange(r.CurrencyChangedHandler);
dtmodel.TermCCYChanged += new CCYChange(r.CurrencyChangedHandler);

Now in the handler I can call this.Grid.Refresh()

public void CurrencyChangedHandler(string oldCCY, string newCCY)
{
// this.Grid.RefreshRange(GridRangeInfo.Cells(this.RowIndex, this.ColIndex, this.RowIndex, this.ColIndex));
System.Diagnostics.Trace.WriteLine("Refresh Called");
this.Grid.Refresh();
}

But instead of refreshing the entire Grid I need to refresh that cell alone using the RefreshRange function, but the rowindex and colindex are not set when I come into the handler code. Can you please let me know how to do this?

thanks in advance
thanvir

1 Reply

HA haneefm Syncfusion Team July 24, 2007 06:32 PM UTC

Hi Thanvir,

You can get the RowIndex and ColIndex using the Grid.PointToRowCol method. Below are the code snippet

public void CurrencyChangedHandler(string oldCCY, string newCCY)
{
int row, col;
if(this.Grid.PointToRowCol(System.Windows.Forms.Control.MousePosition , out row, out col) && row == 0 && col > 0)
{
this.Grid.RefreshRange(GridRangeInfo.Cell(row,col));
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon