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.

serching each cell and highlighting colour of cell

Thread ID:

Created:

Updated:

Platform:

Replies:

57319 Mar 1,2007 07:23 AM Mar 1,2007 01:46 PM Windows Forms 2
loading
Tags: GridControl
swaminath dhavane
Asked On March 1, 2007 07:23 AM

i have to searcheach cell and if condition matches i have to change colour of cell

dhana
Replied On March 1, 2007 07:40 AM


here is the code for searching the text in syncfusion grid

if(SearchText.Length > 0)

{

GridDataBoundGrid grid = this.dgCurrentTransaction;
grid.Focus();
dgCurrentTransaction.CurrentCell.MoveTo(this.dgCurrentTransaction.Model.Rows.HeaderCount,ItemNumber);
GridFindReplaceDialogSink fr = new GridFindReplaceDialogSink(grid);
GridCurrentCell cc = this.dgCurrentTransaction.CurrentCell;
GridRangeInfo frLocationInfo = GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex);
string str =(string)this.dgCurrentTransaction[cc.RowIndex, cc.ColIndex].Text;
if(SearchText!=frLocationInfo.ToString())
{
this.dgCurrentTransaction.Selections.Clear();
this.dgCurrentTransaction.BeginUpdate();
this.dgCurrentTransaction.Selections.Add(GridRangeInfo.Cells(this.dgCurrentTransaction.Model.Rows.HeaderCount ,ItemNumber,dgCurrentTransaction.Model.RowCount, dgCurrentTransaction.Model.ColCount));
GridFindReplaceEventArgs fre = new GridFindReplaceEventArgs(SearchText,"", GridFindTextOptions.SelectionOnly|GridFindTextOptions.MatchWholeCell, frLocationInfo);
fr.Find(fre);
if(fr.Find(fre) !=null)
{
grid.Selections.Clear();
this.dgCurrentTransaction.EndUpdate();
grid.Refresh();
}
else
{
grid.Selections.Clear();
this.dgCurrentTransaction.EndUpdate();
grid.Refresh();
string mstr;
mstr="Search text " + SearchText + " not found";
MessageBox.Show(mstr, "Search", MessageBoxButtons.OK ,MessageBoxIcon.Information);

}
}
else
{
MessageBox.Show("Record Not Found!!!!!!!");
}
}

Administrator [Syncfusion]
Replied On March 1, 2007 01:46 PM

Hi,

Here is a minimal sample that implements GridFindReplaceDialog for searching the cellvlues in a grid. It can be used without displaying the dialog. Please refer to the attached sample for more details.

GridControlFind.zip

Best Regards,
Haneef

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.

;