Hi I have problems with the UserAddingRow event, in the child levels of the main if the property e.cancel = True does not let me leave the grid editor, even if I cancel the edition I can not leave the grid row editor, could someone help me thanks beforehand
6 Answers, 1 is accepted
0

Parker
Top achievements
Rank 1
answered on 10 May 2018, 02:33 PM
I am running into this same problem. Cancelling the UserAddingRow event doesn't allow me to edit any other grid. No other control is responsive until the new row is successfully added.
0
Hi,
This is the default behavior (by design). Instead of canceling the event you can use the CancelAddNewRow method. Here is an example:
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
This is the default behavior (by design). Instead of canceling the event you can use the CancelAddNewRow method. Here is an example:
private
void
RadGridView1_UserAddingRow(
object
sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e)
{
if
(e.Rows[0].Cells[
"Name"
].Value ==
null
)
{
radGridView1.MasterView.TableAddNewRow.CancelAddNewRow();
}
}
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0

Daniel
Top achievements
Rank 1
answered on 29 May 2018, 07:32 PM
Hello, if it works like this, but there will be some way that I will leave the writing in the row to add I have a help list as the user writes and I pass the focus to this to select from the list
0

Daniel
Top achievements
Rank 1
answered on 29 May 2018, 09:35 PM
The problem with this is that if I want to edit another cell but I do not want to add the row until the whole row is validated, it eliminates what I already put in the first cell, the 2015 version did not have this problem and I already changed to the 2017 all
0
Accepted
Hi Daniel,
In order to leave the new row without adding it or without losing the values you will need to create a custom GridViewNewRowInfo and override the following methods:
Change the default row in the CreateRowInfo event handler (subscribe at design time):
Please note that with this approach you will need to manually add the row at some point (call the EndAddNewRow method).
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
In order to leave the new row without adding it or without losing the values you will need to create a custom GridViewNewRowInfo and override the following methods:
class
MyNewRow : GridViewNewRowInfo
{
public
MyNewRow(GridViewInfo info) :
base
(info)
{
}
protected
override
bool
OnBeginEdit()
{
return
true
;
//base.OnBeginEdit();
}
protected
override
bool
OnEndEdit()
{
return
true
;
// base.OnEndEdit();
}
protected
override
void
OnPropertyChanged(PropertyChangedEventArgs e)
{
if
(e.PropertyName ==
"IsCurrent"
&& !IsCurrent)
{
return
;
}
base
.OnPropertyChanged(e);
}
}
Change the default row in the CreateRowInfo event handler (subscribe at design time):
private
void
radGridView1_CreateRowInfo(
object
sender, GridViewCreateRowInfoEventArgs e)
{
if
(e.RowInfo
is
GridViewNewRowInfo)
{
e.RowInfo =
new
MyNewRow(e.ViewInfo);
}
}
Please note that with this approach you will need to manually add the row at some point (call the EndAddNewRow method).
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0

Daniel
Top achievements
Rank 1
answered on 30 May 2018, 07:35 AM
Hello, thank you so much for taking the time to appreciate it.