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

GridFindReplaceDialogSink.Find method

hello, i''m using GridFindReplaceDialogSink for seraching in the grid, Find method of this not locating the first row, first column of the grid. how do first row, first column can be located? thanks in advance..

4 Replies

AD Administrator Syncfusion Team May 30, 2004 05:50 AM UTC

Are you explicitly making the cell where the search should begin the current cell before you start the search? Here is a sample that seems to catch the top properly for me. Find_8720.zip


AD Administrator Syncfusion Team June 19, 2004 07:11 AM UTC

hello, i''m not explicitly setting the current cell and my requirement does not allow it. Problem is like this, current cell is (10,1) and Find method will be executed, even though the search string is present in Cell (1,1), it doesn''t locate it, ie. first row is not getting considered in the Find process. thanks. >Are you explicitly making the cell where the search should begin the current cell before you start the search? > >Here is a sample that seems to catch the top properly for me. > >Find_8720.zip > >


AD Administrator Syncfusion Team June 19, 2004 01:01 PM UTC

I think this is a bug we will have to fix in our code. The code is explicitly skipping that cell when you do a find on the whole table if the search does not start at cell 1,1. Here is code that made things work for me in the sample by using an explicit range (slightly enlarged to avoid the bug) to search the whole table.
private void button1_Click(object sender, System.EventArgs e)
{
	GridDataBoundGrid grid = this.gridDataBoundGrid1;
	grid.Focus();//set focus back to the grid from the button
	string search = this.textBox1.Text;
	if(search.Length > 0)
	{
		fr = new GridFindReplaceDialogSink(grid);
		GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
		frLocationInfo = GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex);
		this.gridDataBoundGrid1.BeginUpdate();
		this.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Cells(1,0,this.gridDataBoundGrid1.Model.RowCount, this.gridDataBoundGrid1.Model.ColCount));
		fre = new GridFindReplaceEventArgs(search, "", GridFindTextOptions.SelectionOnly|GridFindTextOptions.MatchWholeCell, frLocationInfo);
		fr.Find(fre);
		grid.Selections.Clear();
		this.gridDataBoundGrid1.EndUpdate();
		grid.Refresh();
		//grid.Selections.Add(GridRangeInfo.Row(grid.CurrentCell.RowIndex));
	}
}


AD Administrator Syncfusion Team June 21, 2004 07:03 AM UTC

thanks, it worked.. below code will do column only search ''grid.Selections.Add(GridRangeInfo.Cells(0,2,grid.Model.RowCount, 2))'' this will search only the column 2 here, to include the first row,Selection Range''s Top is setted as 0 >I think this is a bug we will have to fix in our code. The code is explicitly skipping that cell when you do a find on the whole table if the search does not start at cell 1,1. > >Here is code that made things work for me in the sample by using an explicit range (slightly enlarged to avoid the bug) to search the whole table. > >
>private void button1_Click(object sender, System.EventArgs e)
>{
>	GridDataBoundGrid grid = this.gridDataBoundGrid1;
>	grid.Focus();//set focus back to the grid from the button
>	string search = this.textBox1.Text;
>	if(search.Length > 0)
>	{
>		fr = new GridFindReplaceDialogSink(grid);
>		GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
>		frLocationInfo = GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex);
>		this.gridDataBoundGrid1.BeginUpdate();
>		this.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Cells(1,0,this.gridDataBoundGrid1.Model.RowCount, this.gridDataBoundGrid1.Model.ColCount));
>		fre = new GridFindReplaceEventArgs(search, "", GridFindTextOptions.SelectionOnly|GridFindTextOptions.MatchWholeCell, frLocationInfo);
>		fr.Find(fre);
>		grid.Selections.Clear();
>		this.gridDataBoundGrid1.EndUpdate();
>		grid.Refresh();
>		//grid.Selections.Add(GridRangeInfo.Row(grid.CurrentCell.RowIndex));
>	}
>}
>

Loader.
Live Chat Icon For mobile
Up arrow icon