Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
305
Hitting enter doesn't fire KeyDown Event
posted

Hi

I am using ultraGrid (NetAdvantage 8.1 Win CLR2x). When user hits Enter Key on a row i have to show the details of the row on a different form.

KeyDown event is not getting fired when i hit enter on row. Can any one help me?

 private void ultraGridCatalogVehicles_AfterRowActivate(object sender, EventArgs e)
        {
          
            ultraGridCatalogVehicles.KeyDown += new KeyEventHandler(ultraGridCatalogVehicles_KeyDown);
        }

 void ultraGridCatalogVehicles_KeyDown(object sender, KeyEventArgs e)
        {

                if (e.KeyCode == Keys.Enter)
                {
                    if (ultraGridCatalogVehicles.Rows.Count > 0)
                    {
                        int rowIndex = ultraGridCatalogVehicles.ActiveRow.Index;
                        int catalogVehicleId = Convert.ToInt32(ultraGridCatalogVehicles.Rows[rowIndex].Cells["CatalogVehicleId"].Value);
                       
                    }
                }
          
        }

Parents
  • 469350
    Suggested Answer
    Offline posted

    Are you saying that the event fires for other keys and just not the enter key?

    If that's the case, then my best guess is that it's because the grid is actually using the Enter key for something. Maybe because the enter key is mapped to some action in the KeyActionMappings.

    Or perhaps some other control on the form is using the enter key. For example, do you have a toolbar on the form with a tool that is using Enter as a shortcut? If so, Enter will not fire events for any controls on the form.

Reply Children
No Data