RE: How to return to parent record using the keyboard?
v-jetan_at_online.microsoft.com
Date: 03/09/04
- Next message: Alvin Bruney [MVP]: "Re: Problem accessing Text property of asp:ButtonColumn column"
- Previous message: v-jetan_at_online.microsoft.com: "RE: How get horizontal scrollbar to display?"
- In reply to: Bill Todd: "How to return to parent record using the keyboard?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 09 Mar 2004 05:59:14 GMT
Hi Bill,
Thank you for posting in the community!
Based on my understanding, you bind your datagrid to a dataset. When you
are viewing a child table, you want to find a way to use KeyBoard to
navigate to the "table link" mode.
===========================
Actually, when you are viewing the child table, there should be a
navigation button at the right top corner of the datagrid(Which will
display as "<-" ). You can click this button to return to the parent row.
But, as you need, you want to use keyboard to control the navigation. To
get this done, I think you should intercept the keystroke of the datagrid,
then use DataGrid.Navigate to method to navigate to your wanted table. So
first, you should inherit from the DataGrid control. Then override the
ProcessCmdKey method. Do like this:
private const int WM_KEYDOWN=0x100;
private const int WM_KEYUP=0x101;
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
Keys keyCode = (Keys)(int)msg.WParam & Keys.KeyCode;
if((msg.Msg == WM_KEYDOWN || msg.Msg == WM_KEYUP) && keyCode == Keys.Left
)
{
DataSet ds=(DataSet)this.DataSource;
this.NavigateTo(0, ds.Tables[0].TableName);
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
In the code, I intercept the "Left" navigation key stroke, then navigate to
the first table link in your dataset.
Addtionally, this group is for Asp.net Web Form datagrid, while your
questions are related with WinForm DataGrid control. So I suggest you post
in microsoft.public.dotnet.framework.windowsforms.
The reason why we recommend posting appropriately is you will get the most
qualified pool of respondents, and other partners who the newsgroups
regularly can either share their knowledge or learn from your interaction
with us. Also, this is to make sure that the responders can better track
the problem.
Thank you for your understanding.
=================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
- Next message: Alvin Bruney [MVP]: "Re: Problem accessing Text property of asp:ButtonColumn column"
- Previous message: v-jetan_at_online.microsoft.com: "RE: How get horizontal scrollbar to display?"
- In reply to: Bill Todd: "How to return to parent record using the keyboard?"
- Messages sorted by: [ date ] [ thread ]