This is a migrated thread and some comments may be shown as answers.

Gridview Filtering Control FOCUS

3 Answers 117 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jorge
Top achievements
Rank 1
jorge asked on 20 Aug 2009, 09:22 PM
Hi, I am trying to set Focus on the GridView Filtering box when F2 Key is pressed.

Any idea ?

regards

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 21 Aug 2009, 09:17 AM
Hi jorge,

Filter rows are skipped upon keyboard navigation, so I guess that you need F2 to be an application wide command. Please note that if you use the work-around below you will not be able to start editing a normal cell because the F2 key will be handled at application level and the message will not reach the normal cell.

Here is the code:

[STAThread] 
static void Main() 
    Application.EnableVisualStyles(); 
    Application.SetCompatibleTextRenderingDefault(false); 
    Form5 form = new Form5(); 
    Application.AddMessageFilter(form); 
    Application.Run(form); 

and for your form:

public partial class Form5 : RadForm, IMessageFilter 
    public Form5() 
    { 
        InitializeComponent(); 
    } 
    #region IMessageFilter Members 
 
    public bool PreFilterMessage(ref Message m) 
    { 
            //key down 0x0100 
            //F2 113 
            if (m.Msg == 0x0100 && m.WParam == new IntPtr(113)) 
            { 
                 this.radGridView1.MasterGridViewInfo.TableFilteringRow.Cells[0].BeginEdit(); 
                return true
            } 
 
            return false
        } 
        #endregion 

I hope that helps. Do not hesitate to write me back if you have further questions.

Greetings,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
jorge
Top achievements
Rank 1
answered on 21 Aug 2009, 03:17 PM
Thanks Nick!! I will try to write it in VB if i cant i will ask for your help again.

Thnx!
0
Nick
Telerik team
answered on 24 Aug 2009, 07:23 AM
Hello jorge,

You can use this C# to VB converter. Most of the time it works ok so in general you have to make only minor changes to the converted code.

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
jorge
Top achievements
Rank 1
Answers by
Nick
Telerik team
jorge
Top achievements
Rank 1
Share this question
or