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

How to detect mouse click on grid row

7 Answers 1165 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ofer
Top achievements
Rank 1
Ofer asked on 18 Jun 2009, 08:33 AM
We need to run C# code when the user clicks on a grid data row.
(Single left-mouse-button click).

Which event or other way to use?

Thanks!

7 Answers, 1 is accepted

Sort by
0
gerbrand
Top achievements
Rank 2
answered on 18 Jun 2009, 09:02 AM
Hi,

There is a "MouseClick" event on the radgrid

gerbrand
0
Ofer
Top achievements
Rank 1
answered on 18 Jun 2009, 07:44 PM
Thanks for the answer but it doesn't solve the problem.

Each grid row contains data columns and two "command" columns with buttons.
We need a different action for the "row data click" and for each of the buttons.

The grid's selection mode is Row Selection.

How to do a C# if the user clicks the data cells in a grid row, 
and do a different action when the user clicks the buttons in the grid row?

Thanks, we use the Telerik WinForms 2009 SP1, VS2008, .Net 3.5
0
Jack
Telerik team
answered on 19 Jun 2009, 12:21 PM
Hi Ofer,

You should handle the CellClick event. Here is a sample:

void radGridView1_CellClick(object sender, GridViewCellEventArgs e) 
    if (e.RowIndex >= 0) 
    { 
        GridViewDataRowInfo clickedRow = this.radGridView1.Rows[e.RowIndex]; 
        //... 
    } 

A bit off-topic: if your company has purchased our controls already, please ask the purchase holder to add you as a License Developer to the purchase. This will give you direct access to our support ticketing system and services. More on License Developers you can find here: www.telerik.com/account/faqs.aspx

Regards,
Jack
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
Arun
Top achievements
Rank 1
answered on 11 Jun 2013, 04:00 PM
I am having trial installed. I dont have mouse click event on radgrid.
0
Stefan
Telerik team
answered on 14 Jun 2013, 11:42 AM
Hi Arun,

Our Dev and Trial versions are no different and the controls have exact the same logic and API and the CellClick event exists in both:
radGridView1.CellClick+=radGridView1_CellClick;

I hope this helps.
 

Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
0
Arun
Top achievements
Rank 1
answered on 15 Jun 2013, 12:52 PM
Dear Team,

My Code Behind is :

 protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid1.CellClick += radGridView1_CellClick;
    }
    private void radGridView1_CellClick(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex >= 0)
        {
            GridViewRowEventArgs clickedRow = this.RadGrid1.Rows[e.Row.RowIndex];
        }
    }

I am not able to add cellclick event on radgrid..


I am struggled for last 1 week..
0
Stefan
Telerik team
answered on 17 Jun 2013, 05:52 AM
Hello Arun,

This forum concerns RadControls for WinForms, while your question seems to be related to RadControls for ASP.NET AJAX. Please address it to the appropriate forums in order to get adequate assistance: http://www.telerik.com/community/forums/aspnet-ajax/grid.aspx.
 
Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
GridView
Asked by
Ofer
Top achievements
Rank 1
Answers by
gerbrand
Top achievements
Rank 2
Ofer
Top achievements
Rank 1
Jack
Telerik team
Arun
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or