[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Determining whether the user selected a different row on datagrid

Posted on 2004-11-01
Medium Priority
Last Modified: 2010-04-15

is there a simple way to determine whether the user clicked on a different row inside the datagrid?


Question by:brdrok
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

dsabo earned 200 total points
ID: 12467880
You could use the property currentrowindex of the datagrid and the event CurrentCellChanged. Also you need to add a variable to know if the selection is a new row or just a new cell.

int LastRow = 0;


private void grid1_CurrentCellChanged(object sender, System.EventArgs e)
    if(LastRow != grid1.CurrentRowIndex)
           LastRow = grid1.CurrentRowIndex;

           // ROW CHANGED--- wrtie your code here

Expert Comment

ID: 12473277
Do you mean if someone clicks on a different row? whether they click update button or similar?

Well basically with most events in the Datagrid you have the arguements in the Event handler you can find out which row has been selected from that ....

e.Item.Cells[0] is the first cell data... 0 being the index of the cell...

This way for any type of command or event you can know if the row has been changed.

Author Comment

ID: 12482449
thanks dsabo....

worked out pretty good.


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question