Delete row on grid

7 posts, 0 answers
  1. thanhh83
    thanhh83 avatar
    2 posts
    Member since:
    May 2007

    Posted 22 May 2007 Link to this post

    I want delete a row on GridView. But i don't know how to delete it and update it to database

    Help me please

    Thanks and regards
  2. PortVista
    PortVista avatar
    61 posts
    Member since:
    Oct 2006

    Posted 22 May 2007 Link to this post

    There are 4 or 5 ways to do this. We'll give you a better answer if you tell us more info...
  3. UI for WinForms is Visual Studio 2017 Ready
  4. thanhh83
    thanhh83 avatar
    2 posts
    Member since:
    May 2007

    Posted 22 May 2007 Link to this post

    I'm using dataTable load data from database, binding this datatable to datasource of gridview. And i'm using "Right Click" to select "delete row". And this row has been deleted on GridView. Now i want after "delete row" it will delete this row on GridView and it will delete this item on database.

    I don't known Event ocurr when delete this row. Please give me that event

    Thanks and regards
  5. Sasa Milovic
    Sasa Milovic avatar
    15 posts
    Member since:
    Dec 2006

    Posted 10 Jul 2007 Link to this post

    I have a similar query

    When deleting a row of the grid, I would like to capture the event, query the row, and then inform another object that this row has been deleted.

    The problem is I cannot find a method such as userDeletingRow as available in the MS grid.
  6. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 10 Jul 2007 Link to this post

    Hi Sasa,

    We have just replied to your support ticket on the matter.

    Currently we are not providing an event for the delete operation. This feature will be included in our Q2 release. What you can do is use the IBindingList ListChanged event if your bound objects support the IBindingList interface.
     

    Regards,
    Julian Benkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. hipero
    hipero avatar
    3 posts
    Member since:
    Dec 2006

    Posted 13 Oct 2009 Link to this post

    But you can do something like this:


            private void dataGridViewMain_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
            {
                if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) 
                { 
                    DialogResult dialogResult = MessageBox.Show("Do you want to delete this product?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); 
                    if (dialogResult != DialogResult.OK) 
                    {
                        e.Cancel = true; 
                    } 
                }
            }

    and add your code to update data in data base :).
  8. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 02 Sep 2010 Link to this post

    Hi ,

    In Q2 2010 release we introduced UserDeletingRow and UserDeletedRow events. You can use them in your scenario.

    All the best,
    Julian Benkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready