19 Answers, 1 is accepted
I'm not sure I completely understand your scenario.
In Q1 2008, the event system of the RadGridView has been changed. In older versions, there were a variety of events for the different operations that can be performed on the data stored in the grid. These have been replaced by one event, which is raised with different event args.
This means that you will not have to place your code in the handler for a different event. Place all of the code you need to perform after a deletion of a row in the handler of the RowChanging event. You only need to verify that the event arguments indicate that a row has been deleted.
If you have any further questions, please contact me.
All the best,
Kiril
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Private
Sub RadGridView1_RowsChanging(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangingEventArgs) Handles RadGridView1.RowsChanging
''' MsgBox("step row changing")
If e.Action = Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove Then
Dim cCancel As DialogResult
cCancel = MessageBox.Show(
"Are you sure you want to delete the selected row ?", SystemConfiguration.MessageTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If cCancel = DialogResult.Yes Then
If Me.RadGridView1.Rows(CurrentRow).IsCurrent = False Or Me.RadGridView1.Rows(CurrentRow).Cells(ItemNumberColumn).Value.ToString() = "" Then
Else
UpdateITMTable.SubQtyInEachItemLine(Me.RadGridView1.Rows(CurrentRow).Cells(ItemNumberColumn).Value, Me.RadGridView1.Rows(CurrentRow).Cells(QuantityColumn).Value)
CurrentRowDeleted =
True
End If
Else
e.Cancel = True
End If
End If
End Sub
this is wut i m doing behid the rowchanging event ... here if we have only 1 row ... row changing event will occured and i say yeah i want to delete the row and my code behind deletion do some calculations on grid rows count. if i call it here then rows will be still 1 as this event is in process.
the calculation code only needs to call at RowChanged Event as you ppl also mention that in Q1 2008
RowDeleting
/RowDeleted events have been replaced by RadGridView
RowsChanging
/RowsChanged events.
the only problem is that if we have only 1 row in gridview we cant be able to catch RowChanged Event.bt if we have more then one row it works f9.
Thank you for writing.
I managed to reproduce the issue you described, and I thank you for bringing our attention to the issue. This issue will be addressed for the Q2 2008 release. For the time being, You'll be able to place your code which is meant to be executed in the handler of the CurrentRowChanged after row deletion the RowsDeleting event.
Let me know whether this solves the issue in your scenario.
Your Telerik points have been updated. If you have any further questions, please let me know.
Kind regards,
Kiril
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
dear i already tried to solve this issue wd CurrentRowChanged handler bt just failed it gives an error
"This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row."
at CurrentRowChanged event i observed it did not decrease the radGrid Row.
i think i need to change my code for the purpose :) ...
Excuse me for taking so long to resolve this issue. The issue you reported has been added to our TODO list and will be resolved in one of the future releases. For the time being, there's another method you can use to execute logic following the deletion of a row - subscribe to the ListChanged method the datasource of the grid control.
this.radGridView1.DataSource = customersBindingSource; |
customersBindingSource.ListChanged += new ListChangedEventHandler(customersBindingSource_ListChanged); |
In the handler of this event, you can place the code below, to let you know when an item has been deleted:
void customersBindingSource_ListChanged(object sender, ListChangedEventArgs e) |
{ |
switch (e.ListChangedType) |
{ |
case ListChangedType.ItemDeleted: |
//your code here |
break; |
} |
} |
I hope this helps. If you have further questions, please let me know.
Regards,
Kiril
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I have encountered the same issue which my last row deletion event never get the chance to fire.The suggested method is taggng on bindingsource whch i am not using. Any alternative ways for non-binding datasource.
David
Thank you for this question.
I confirm that in the latest release of RadGridView the RowsChanged event isn't fired when there is only one row. This issue will be addressed in our upcoming service pack.
To work around the issue you could process the RowChanging event instead. Consider the code below:
void radGridView1_RowsChanging(object sender, GridViewCollectionChangingEventArgs e) |
{ |
if (e.Action == NotifyCollectionChangedAction.Remove) |
{ |
} |
} |
I hope this helps you. Please let me know if you need further assistance.
Regards,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
That will not help as after the last row deletion, i need to trigger a function to recalcute the figures. At row changing, the grid row count is still at 1 and only after this event than that row data is clear.
Plus i encountered grid index=-1 error after i delete the all grid rows and edit one column of the new row i created. Please advise.
Thank you for getting back to me.
Our next service pack will be released in 10 days from now and it will address this issue. If the issue is a show stopper for you, please send me a sample project that reproduces it (you can do so in a support ticket). I will try to find a solution for you.
Do not hesitate to write me if you have other questions.
Greetings,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Jack, I've just spent an hour on this using the latest version of controls and my experience is that the _RowsChanged event still does not work properly. Regardless of row number or how many rows are left, when removing a row it fills the NewItems[] collection with one row - it should fill the OldItems and it's not even the row I deleted! Very frustrating.
Can you confirm this is still an existing bug with the grid, or is this something new to report?
Regards
Ewart.
Thank you for bringing our attention to this issue.
I understand your frustration and to my regret I have to can confirm that it still exists. I have added the issue with high priority in our TODO for the upcoming service pack. Your Telerik points have been updated.
Don't hesitate to contact us if you have other questions.
Greetings,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
The RowsChanged event is fired after removing the row in this case. So, it is not possible to get an instance to the row, because it is already destroyed. Because of all this, the OldItems array is empty. The NewItems array contains the new row at the specified position. This behavior is by design.
I would suggest using the RowsChanging event to get the row that is being deleted. If you need any further assistance I will be glad helping you.
All the best,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I'm setting the datasource of my radgridview to a datatable. When I remove the first row of the datagrid programatically from the datatable....the datasource is updated accurately...but the gridview does not update...so therefore the gridview is out of sync with the datasource.
(I'm using RadControls for WinForms...Version 7.1.1.0)
Is there a work around for this yet?
Thanks,
Ryan
Thank you for your question.
Yes, we did have this problem, add it has been addressed since. I tired it again with the latest version and the grid updates properly. I would recommend trying the Q3 2008 SP1 version of RadControls for WinForms. We will highly appreciate any feedback you have.
Do not hesitate to write us if you have other questions.
Regards,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
"Exception has been thrown by the target of an invocation."
Thank you for getting back to us.
I need more information to locate the source for this issue. Could you, please open a support ticket and send me your application that reproduces the issue? This will help me find a proper solution for you.
Thank you in advance for your cooperation.
Sincerely yours,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for contacting us. I tested this case, however I was not able to reproduce the issue. Please send me your application and I will try to locate the issue and find a proper solution. Thank you in advance.
I am looking forward to your reply.
Jack
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.