Visual WebGui Wiki Site
 
  Forum  Commercial Foru...  Commercial Foru...  DataGridView navigation (Enter key issue)
Previous Previous
 
Next Next
New Post 8/24/2009 6:49 AM
  Shamanenas
21 posts
www.bis.lt
No Ranking


DataGridView navigation (Enter key issue) 

Hello,

We have readonly datagrid with full row selection mode. In the grid one can navigate with keys Up and Down. When hitting Enter the selected record shall be opened in the dialog window. The problem is that Enter key acts the same like KeyDown. It means the next grid record is selected. is there any method to change default behaviour of the Enter in the datagridview control.

 

thanks,


-- Zilvinas
 
New Post 8/24/2009 10:56 AM
  palli
6080 posts
1st Level Poster




Re: DataGridView navigation (Enter key issue) 

Hi Zilvinas,

The way I would do it is to register a KeyDown event handler on the DataGridView, setting DataGridView.KeyFilter = KeyEnter (to not add too much events being fired) and that should be it.

The only drawback I see is that we have a minor problem regarding flagging to the DataGridView that we have allready processed the keycode, as you can see in this issue I just opened here.

You can use the attached sample application(s) to see how I did this. What happens is that after the MessageBox is shown, the DataGridView still advances to the next row. You might be able to work around it by handling setting the CurrentCell afterwards, but I did not test that.

Hope this helps,

Palli

 

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 8/25/2009 1:46 AM
  Shamanenas
21 posts
www.bis.lt
No Ranking


Re: DataGridView navigation (Enter key issue) 

Hi Palli,

Situation is exactly as you have described . But DataGridView and the Dialog Window which is opened from the grid, is binded to the same DataSource. And when grid row advances data is changed in the associated dialog window (current row in datasource is changed). We of cource can try to simulate and move afterwards programatically, but  it will lead to flickering. And makes my customer angry .  If we are trying to implement the functionality, you have proposed, is there any way to do something like setredraw = false and the back to true after data is retrieved?


-- Zilvinas
 
New Post 8/25/2009 12:11 PM
  palli
6080 posts
1st Level Poster




Re: DataGridView navigation (Enter key issue) 

Hi Zilvinas,

I would have tried either the CellValidating or RowValidating events as a second choice and setting e.Canceled = True, but they are also being fixed in open issues so there's no easy way out.

Problem is that when the KeyDown event fires, the CurrentCell has allready changed, as it seems, so this is not easy to do.

I will have to check a few events and see if they behave the way they should, and if not, open new issue(s).

Sorry about this.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 8/26/2009 11:18 AM
  palli
6080 posts
1st Level Poster




Re: DataGridView navigation (Enter key issue) 

Hi again,

I have now checked these DataGridView events a little further and I opened a new issue on the subject which you can track here.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  DataGridView navigation (Enter key issue)
Most promising startups
Top 3 most promising startups in 2009
   AJAX Framework | Web Development | Cloud applications | RIA Development | Silverlight Applications | Legacy Migration
The most popular open source Ajax applications framework for enterprises | Sitemap | Terms Of Use | Privacy Statement
Copyright © 2005-2009 Visual WebGui®    Design By: Template World
   
Visual Studio Partners