How to detect mouse click on grid row

8 posts, 0 answers
  1. Ofer
    Ofer avatar
    14 posts
    Member since:
    Apr 2009

    Posted 18 Jun 2009 Link to this post

    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!
  2. gerbrand
    gerbrand avatar
    78 posts
    Member since:
    Mar 2009

    Posted 18 Jun 2009 Link to this post

    Hi,

    There is a "MouseClick" event on the radgrid

    gerbrand
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ofer
    Ofer avatar
    14 posts
    Member since:
    Apr 2009

    Posted 18 Jun 2009 Link to this post

    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
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 19 Jun 2009 Link to this post

    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.
  6. Arun
    Arun avatar
    3 posts
    Member since:
    Mar 2013

    Posted 11 Jun 2013 Link to this post

    I am having trial installed. I dont have mouse click event on radgrid.
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 14 Jun 2013 Link to this post

    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?
  8. Arun
    Arun avatar
    3 posts
    Member since:
    Mar 2013

    Posted 15 Jun 2013 Link to this post

    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..
  9. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 17 Jun 2013 Link to this post

    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?
Back to Top
UI for WinForms is Visual Studio 2017 Ready