row removed event

13 posts, 2 answers
  1. karim
    karim avatar
    1 posts
    Member since:
    Jun 2010

    Posted 14 Oct 2010 Link to this post

    hi,

    i have used the CreateRow event in the gridview

    now i need to know witch event is the opposite of this event 

    i need to know the removeRow event in the grid because i can't find it.

    thanks.
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 14 Oct 2010 Link to this post

    Hello Karim,

    I think you are looking for the UserAddedRow / UserAddingRow and UserDeletedRow / UserDeletingRow to get notified when a user creates / removes a row from the grid.

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  3. UI for WinForms is Visual Studio 2017 Ready
  4. karim
    karim avatar
    1 posts
    Member since:
    Jun 2010

    Posted 14 Oct 2010 Link to this post

    Hi Emanuel;

    Thanks for the Reply.

    but i can't find any event with the names you provide me with.

    i hope you be more specific. if it exists tell me where i can find it.?

    i think you want me to add this events to my constructor, correct me if i was wrong please.

    i'm using Q1 2010 winForms on VB.net 2008 application.

    Best Regards;

    karim rateb 
  5. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 14 Oct 2010 Link to this post

    Karim, can you please tell me which version of Telerik controls are you using? The latest is Q2 2010 SP2, ....914.

    Please try to update to the latest version and i will help you further.

    Best Regards,
    Emanuel Varga
  6. karim
    karim avatar
    1 posts
    Member since:
    Jun 2010

    Posted 21 Oct 2010 Link to this post

    hi;

    i have updated my pack to Q2 sp2 2010

    and now i'm facing a whole new error 

    "Unable to cast object of type 'Telerik.WinControls.UI.RadGridViewElement' to type 'Telerik.WinControls.UI.GridTableElement'."

    i have ever seen this error before in my application , now after updating to the new pack this error appeared.

    i didn't change any lines of code in my application and every time i try to run the application it gives me this error each time in different location in my application even at the forms that i have no Rad controls in it.

    Please help.
  7. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 21 Oct 2010 Link to this post

    hi,

    There are quite a few changes in Q2.
    I believe that the syntax for this now is:
    Dim ve As RadGridViewElement = Me.RadGridView1.GridViewElement

    Hope that helps
    Richard
  8. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 21 Oct 2010 Link to this post

    Hello Karim,

    Besides what Richard has pointed out, there are a series of other changes more or less significant, if you have any other problems please let me know.

    P.s. Have you tried the UserDeletingRow yet? do you need any help with that?

    Best Regards,
    Emanuel Varga
  9. karim
    karim avatar
    1 posts
    Member since:
    Jun 2010

    Posted 25 Oct 2010 Link to this post

    Hi;

    thanks for replay, and i have updated my code to work with the new features in Q2 and it works fine now.

    as for the (UserAddedRow...etc) events i have tested it and it works great.

    but here is the problem those events working great when the user inserts or delete rows from the grid

    what i need is the event that fires when a row have been added or removed to/from the grid programmatically 

    take a look on the Microsoft grid events ( RowAdded and RowRemoved ) the 2 events in Microsoft grid response to the new row(s) added by a loop function or any other type of insertion in to the grid.

    now, in your grid events the CreateRow event = RowAdded event in Microsoft (the 2 events do the same things)
    i need the other event RowRemoved in Microsoft = ????? in telerik

    i know i'm bothering you, but those types of events is very important in my application.

    thanks.

  10. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 25 Oct 2010 Link to this post

    Hello again Karim,

    It is no bother whatsoever, I'm always happy to help.
    Please take a look at RowsChangind and RowsChanged events, you can achieve what you need using those events, as in the following example:
    void radGridView1_RowsChanged(object sender, GridViewCollectionChangedEventArgs e)
    {
        if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
        {
            //do something
        }
        else if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
        {
            // do something else
        }
    }
     
    void radGridView1_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
    {
        if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
        {
            //do something
        }
        else if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
        {
            // do something else
        }
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  11. karim
    karim avatar
    1 posts
    Member since:
    Jun 2010

    Posted 25 Oct 2010 Link to this post

    Exactly as i need ,  Thank you.
  12. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 25 Oct 2010 Link to this post

    Hello Karim,

    Glad to be able to help, if you have any more questions please just let me know, and if the question has been solved, please mark the question as answered, so that others can find the answers to their questions faster.

    Best Regards,
    Emanuel Varga
  13. karim
    karim avatar
    1 posts
    Member since:
    Jun 2010

    Posted 26 Oct 2010 Link to this post

    Hi Emanuel 

    Thank you again.
  14. Gustav Mulder
    Gustav Mulder avatar
    5 posts
    Member since:
    Jul 2009

    Posted 16 Nov 2010 Link to this post

    Hi

    Thought this was relevant.  We tried to change the label of a grid at the top, and also got the casting error.  Here is my resolution

    grid.GridViewElement.TableElement.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
    grid.GridViewElement.GroupPanelElement.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;


    Hope it helps someone.

    Cheers

    Gustav
Back to Top
UI for WinForms is Visual Studio 2017 Ready