Row Selection

21 posts, 0 answers
  1. Mitch Thraves
    Mitch Thraves avatar
    20 posts
    Member since:
    Feb 2006

    Posted 29 Apr 2007 Link to this post

    Hi

    I need to know the best way to call a client detail form by clicking on a row in a RadGridView. I'm not sure what code to put in the Click event.

    My RadGridView shows 15 columns of Client data and stores the Client ID column in the first column of the Grid. I want to click on a row and then call a detail form and pass it the selected Client's ID.

    I'm using VB.Net.

    Many thanks
  2. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 02 May 2007 Link to this post

    Hi Mitch,

    Unfortunately, the RadGridView does not currently provide a row click event which would allow you to implement this functionality. It will be provided in Service Pack 1.

    Kind regards,
    Kiril
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Karthik
    Karthik avatar
    23 posts
    Member since:
    Jan 2007

    Posted 03 May 2007 Link to this post

    When is the service pack expected?
  5. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 04 May 2007 Link to this post

    Hello Mitch Thraves,
    You should expect the SP1 release around the mid May (probably around the 15th of May).

    Kind regards,
    Dimitar Kapitanov
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. PortVista
    PortVista avatar
    61 posts
    Member since:
    Oct 2006

    Posted 07 May 2007 Link to this post

    I've found the row or cell click event not really working as far as the MS datagrid goes. It seems to not work when you are hovering over the column size areas. So, I use DoubleClick event and then capture the row that is selected. Are you saying we can't get the selected row with DoubleClick??
  7. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 08 May 2007 Link to this post

    Hello Jason,

    The functionality that is already implemented in the upcoming Serice Pack 1 is the following:

    • A RowSelected event is fired whenever the current row changes because of a mouse click or keyboard navigation. It makes available the row that was selected.
    • A CellClicked event is fired whenever a cell is clicked. This event allows one to obtain the cell (and respectively, the row) clicked.
    • A CellDoubleClicked event is fired whenever a cell is double clicked if that cell is readonly (in case it can be edited, the respective editor is shown after the first mouse click inside the cell area). This event also allows one to obtain the cell (and respectively, the row) clicked.
    In case the above functionality is not sufficient, please give me more information on what you are looking for.

    Best wishes,
    Kiril
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. PortVista
    PortVista avatar
    61 posts
    Member since:
    Oct 2006

    Posted 08 May 2007 Link to this post

    It's hard to know without testing, but it sounds like you're doing what the MS datagrid/view does. The problem with the MS one is that if you have resizable columns, or editable cells, the row or cell click event does not fire, in favor of the column resize or cell edit events.

    You need row double click event too. But again I've just found just capturing the datagrid's double click event to be sufficient. You simply check if there's a row selected. However, if you double click on the header it still fires I believe...  it's not perfect.

    So if you can make the double-click event fire overriding any other event, that would seem to be what we all need. And in some cases, single click, although that wouldn't work with a editable grid...
  9. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 08 May 2007 Link to this post

    Hello Jason,

    Thank you for your feedback.

    We are indeed planning to add a RowDoubleClick event in the upcoming Service Pack 1. It will fire on all rows, and you'll be able also to access the row  type.

    Sincerely yours,
    Kiril
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. xeon
    xeon avatar
    5 posts
    Member since:
    Feb 2007

    Posted 09 May 2007 Link to this post

    Hi,

    This means that is no way to get the selected row?
    In that case this is a pretty useless control.

    Thanks
    Xeon
  11. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 09 May 2007 Link to this post

    Hi Laszlo,

    In all the events described so far:

    • RowSelected
    • RowDoubleClicked
    • CellSelected
    • CellDoubleClicked
    you will be able to access the selected row, together with the row type. Sorry I didn't state that explicitly in the previous messages.

    Kind regards,
    Kiril
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  12. PortVista
    PortVista avatar
    61 posts
    Member since:
    Oct 2006

    Posted 10 May 2007 Link to this post

    Ok how do I get the selected row now? CurrentRow isn't available...

    MS DataGrid
    dgList.CurrentRow.Cells.Item("ContactID").Value

  13. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 15 May 2007 Link to this post

    Hello Jason,

    Thank you for bringing up this issue. We need to better document the use of current row, as well as the events that are fired when it changes.

    Onto your question - a straightforward way to get the current row is to use the CurrentRow property of the GridViewInfo. Here's a short code snippet illustrating this:

    GridViewRowInfo currentRow = radGridView1.MasterGridViewInfo.CurrentRow; 

     
    All the best,
    Kiril
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  14. xeon
    xeon avatar
    5 posts
    Member since:
    Feb 2007

    Posted 15 May 2007 Link to this post

    Hi,

    Maybe this is trivial for everyone, but i added a snipet for selecting value.

    GridViewRowInfo currentRow = radGridView1.MasterGridViewInfo.CurrentRow;

    GridViewDataRowInfo current = currentRow as GridViewDataRowInfo;
    DataRowView drow = current.DataRowView;
    MessageBox.Show(drow["Name"].ToString());
  15. PortVista
    PortVista avatar
    61 posts
    Member since:
    Oct 2006

    Posted 15 May 2007 Link to this post

    That's insane to create that many references to get the cell value... I'll try one more time here. I'm using VB by the way.
  16. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 15 May 2007 Link to this post

    Hello Jason,

    Again we must apologize for the badly documented and incomplete API.

    In the Q1 SP1 we use:

    string name = radGridView1.MasterGridViewInfo.CurrentRow.Cells["Name"].Value; 

    and you will be able to use the following code:
     
    string name = radGridView1.MasterGridViewInfo.CurrentRow.DataRowView.Row["Name"].ToString(); 

    The Service Pack will probably be live tomorrow as we are still testing it. We will post an announcement in the Announcements forum as soon as we are ready with the release.
     

    Greetings,
    Jack
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  17. PortVista
    PortVista avatar
    61 posts
    Member since:
    Oct 2006

    Posted 15 May 2007 Link to this post

    Well this is the most confusing thread ever. Might as well just delete it.
  18. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 17 May 2007 Link to this post

    Hello Jason,

    I apologize for this misunderstanding. My last post was really confusing. What I meant to say is that in our current version (Q1 SP1) you can access the Cell value by using the Cells property of any Row (e.g):

    string name = radGridView1.MasterGridViewInfo.CurrentRow.Cells["Name"].Value;

    In our previous version (Q1) you can achieve the same with this code:

    string name = radGridView1.MasterGridViewInfo.CurrentRow.DataRowView.Row["Name"].ToString();

     
    Regards,
    Jack
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  19. carisch
    carisch avatar
    7 posts
    Member since:
    Jul 2007

    Posted 25 Jul 2007 Link to this post

    How do i know what service pack (or version) i'm on?  I downloaded the trial on July 24th.
  20. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 26 Jul 2007 Link to this post

    Hi Brian,

    You can check RadControls version in several ways:

    1. Open Visual Style Builder and choose Help -> About from the main menu.
    2. In Windows Explorer, locate and open the "RadControls for WinForms Folder" (usually C:\Program Files\Telerik\RadControls for WinForms Q1 2007\). Navigate to the bin folder, select the Telerik.WinControls.dll (or any of the dll file from the list, except RadChart), right click on it and select Properties -> Version.
    3. A nice Windows feature is that you can show the versions at all times. This is done by adding the File Version column to the explorer view. Here are the steps:
      1. In Windows Explorer, locate and open the "RadControls for WinForms Folder" (usually C:\Program Files\Telerik\RadControls for WinForms Q1 2007\).
      2. Navigate to the bin folder.
      3. Right-click on any column header in the view, and select More...
      4. Locate File Version and check the checkbox.
      5. Click OK. The file versions will appear in the view.
      6. To save the new view layout, go to the Tools menu --> Folder Options --> View tab --> Apply to all folders --> OK.
    You can check the version number against the release version here: Release History.

     
    Kind regards,
    Jack
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  21. Christian
    Christian avatar
    81 posts
    Member since:
    Aug 2008

    Posted 23 Sep 2008 Link to this post

    Hi,
    I use the version 7.1.1.0 and cannot find the event RowDoubleClicked. For a reference I would be grateful.

    Christian
  22. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 24 Sep 2008 Link to this post

    Hello Christian,

    We decided not to implement the RowDoubleClicked event for the time being, because the CellDoubleClicked event is sufficient to obtain the double clicked cell and its respective row. For example if you want to get the row and do some modifications to it, here is how this could be done:
     
    void radGridView1_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)  
    {  
        Console.WriteLine(e.RowIndex);  
        if (e.RowIndex > 0)  
        {  
            GridViewRowInfo row = this.radGridView1.Rows[e.RowIndex] as GridViewRowInfo;  
            if (row != null)  
            {  
                foreach (GridViewCellInfo cell in row.Cells)  
                {  
                    if (cell.ColumnInfo is GridViewDecimalColumn)  
                    {  
                        cell.Value = 0;  
                    }  
                    else if (cell.ColumnInfo is GridViewTextBoxColumn)  
                    {  
                        cell.Value = String.Empty;  
                    }  
                    else if (cell.ColumnInfo is GridViewDateTimeColumn)  
                    {  
                        cell.Value = DateTime.Now;  
                    }  
                }  
            }  
        }  

     
    Please note that on a RadGridView with ReadOnly set to falseCellDoubleClick will be fired only if you double click on the GridRowHeaderCellElement. However, if you click on a normal data cell, its editor will be opened and the CellDoubleClick event will not be fired. If RadGridView.ReadOnly is set to true, the CellDoubleClick event will be fired when you double click on regular data cells as well.

    If you have additional questions, feel free to contact me.
     

    All the best,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for WinForms is Visual Studio 2017 Ready