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

row removed event

12 Answers 313 Views
GridView
This is a migrated thread and some comments may be shown as answers.
karim
Top achievements
Rank 1
karim asked on 14 Oct 2010, 05:55 PM
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.

12 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 14 Oct 2010, 06:12 PM
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
0
karim
Top achievements
Rank 1
answered on 14 Oct 2010, 06:55 PM
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 
0
Emanuel Varga
Top achievements
Rank 1
answered on 14 Oct 2010, 07:33 PM
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
0
karim
Top achievements
Rank 1
answered on 21 Oct 2010, 05:17 PM
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.
0
Richard Slade
Top achievements
Rank 2
answered on 21 Oct 2010, 05:22 PM
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
0
Emanuel Varga
Top achievements
Rank 1
answered on 21 Oct 2010, 05:33 PM
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
0
karim
Top achievements
Rank 1
answered on 25 Oct 2010, 04:09 PM
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.

0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 25 Oct 2010, 04:16 PM
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
0
karim
Top achievements
Rank 1
answered on 25 Oct 2010, 04:59 PM
Exactly as i need ,  Thank you.
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 25 Oct 2010, 09:42 PM
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
0
karim
Top achievements
Rank 1
answered on 26 Oct 2010, 05:39 AM
Hi Emanuel 

Thank you again.
0
Gustav Mulder
Top achievements
Rank 1
answered on 16 Nov 2010, 11:12 AM
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
Tags
GridView
Asked by
karim
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
karim
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Gustav Mulder
Top achievements
Rank 1
Share this question
or