Hi,
I want to implement the find ( Ctrl+F) functionality in GridCotrol. Pls let me give your thoughts/ideas.
If I press Ctrl + F a small dialog window has to popup as in Notepad. Then if search string is there in grid then cursor has to point to that cell.
Thanks
Ravi
AD
Administrator
Syncfusion Team
June 29, 2006 03:33 PM UTC
Hi Ravi,
To implement the find ( Ctrl+F) functionality in a grid, you need to handle the CurrentCellKeyDown event. Here is a code snippet.
private void grid1_CurrentCellKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyValue == 70 && e.KeyCode == Keys.F)
{
e.Handled = true;
fr = new GridFindReplaceDialogSink(this.grid1);
frDialog = GridFindReplaceDialog.Instance;
frDialog.SetState(this.fr, "", false);
frDialog.ShowDialog();
}
}
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/gridFindDialog_ca40e56.zip
Let me know if this helps.
Best Regards,
Haneef
RA
Ravichandran
July 13, 2006 08:48 AM UTC
Hi Haneef,
Thanks.
It is working fine but is there any way to restrict or remove the vales displayed in combobox (Column only,Whole table and Section only) I just want only one option "Whole Table".
And also is there any way to disable the Replace button bcos we dont need that for our application.
Pls help me out
Thanks
Ravi
>Hi Ravi,
>
>To implement the find ( Ctrl+F) functionality in a grid, you need to handle the CurrentCellKeyDown event. Here is a code snippet.
>
>private void grid1_CurrentCellKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
>{
> if(e.KeyValue == 70 && e.KeyCode == Keys.F)
> {
> e.Handled = true;
> fr = new GridFindReplaceDialogSink(this.grid1);
>
> frDialog = GridFindReplaceDialog.Instance;
> frDialog.SetState(this.fr, "", false);
> frDialog.ShowDialog();
> }
>}
>
>Here is a sample.
>http://www.syncfusion.com/Support/user/uploads/gridFindDialog_ca40e56.zip
>
>Let me know if this helps.
>Best Regards,
>Haneef
AD
Administrator
Syncfusion Team
July 13, 2006 09:10 AM UTC
Hi Ravi,
Use this code snippet to hide the replace button and remove combobox item in a GridFindReplaceDialog.
fr = new GridFindReplaceDialogSink(this.gridDataBoundGrid1);
frDialog = GridFindReplaceDialog.Instance;
frDialog.SetState(this.fr, "", false);
//For diable the replace here
foreach(Control c in frDialog.Controls)
{
if(c.Text.IndexOf("place") > -1)
c.Visible = false;
if(c.Text.IndexOf("Find") > -1)
c.Click +=new EventHandler(c_Click);
//Remove the ComboBox Select Item........
if( c is ComboBox)
{
if( c.Name == "comboBoxSelection" )
{
ComboBox combo = c as ComboBox;
System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
sc.Add("Whole Table");
combo.DataSource = sc;
}
}
}
frDialog.ShowDialog();
Here is a modified sample.
http://www.syncfusion.com/Support/user/uploads/gridFindDialog_ef28ef39.zip
Let me know if this helps.
Best Regards,
Haneef
AD
Administrator
Syncfusion Team
July 13, 2006 09:22 AM UTC
Hi Ravi,
Sorry for the inconvenience caused.
Here is a modified sample.
http://www.syncfusion.com/Support/user/uploads/gridFindDialog_6f4b598f.zip
Best Regards,
Haneef
RA
Ravichandran
July 13, 2006 09:52 AM UTC
Thanks a lot Haneef...
>Hi Ravi,
>
>Sorry for the inconvenience caused.
>
>Here is a modified sample.
>http://www.syncfusion.com/Support/user/uploads/gridFindDialog_6f4b598f.zip
>
>
>Best Regards,
>Haneef
>
RA
Ravichandran
August 3, 2006 04:11 PM UTC
Hi Haneef,
How to change the Find Form''s caption. By default it is coming as "GridFindReplaceDialog".
Pls reply asap.
Thanks & Regards
Ravi
>Thanks a lot Haneef...
>
>>Hi Ravi,
>>
>>Sorry for the inconvenience caused.
>>
>>Here is a modified sample.
>>http://www.syncfusion.com/Support/user/uploads/gridFindDialog_6f4b598f.zip
>>
>>
>>Best Regards,
>>Haneef
>>
RA
Ravichandran
August 3, 2006 04:14 PM UTC
Hi
Thanks.. I found the property to change the caption of find form.
Cheers
Ravi
>Hi Haneef,
How to change the Find Form''s caption. By default it is coming as "GridFindReplaceDialog".
Pls reply asap.
Thanks & Regards
Ravi
>Thanks a lot Haneef...
>
>>Hi Ravi,
>>
>>Sorry for the inconvenience caused.
>>
>>Here is a modified sample.
>>http://www.syncfusion.com/Support/user/uploads/gridFindDialog_6f4b598f.zip
>>
>>
>>Best Regards,
>>Haneef
>>