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

UserAddedRow event not fired when in the empty space in the grid

3 Answers 177 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vincent Willems
Top achievements
Rank 2
Vincent Willems asked on 10 Jan 2012, 03:46 PM
Hi,

When I want to add a new row (by the 'add new row line') to my grid, it works fine when I commit the new row by pushing the 'enter' key. But when I fill in some new data in the new row line and I click (by mouse) in the empty space in the grid. The new row appears in the grid but its not commited,& it does not fire the UserAddedRow event.
How is it possible to make the new data is commited not by pressing the 'enter' key but by clicking in the empty space in the grid?

Kind regards

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 13 Jan 2012, 10:15 AM
Hello Vincent Willems,

Thank you for contacting us.

This appears to be an issue and I logged it in our issue tracking system. We will address it in one of our upcoming releases. I updated also your Telerik points for bringing our attention to this issue.

You can work around it by using the RowsChanged event instead:
void radGridView1_RowsChanged(object sender, GridViewCollectionChangedEventArgs e)
{
    if (e.Action == NotifyCollectionChangedAction.Add)
    {
        //...
    }
}

If you need further assistance, please do not hesitate to write back.

Kind regards,
Jack
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Ralph
Top achievements
Rank 1
answered on 25 Jan 2012, 06:38 PM
I have a similar need.  I cannot find the event which fires when the user clicks on the "add new row" link on RadGrid.

I need to do somethings before the user sees the insertion form.

Been looking all over for this event, can't seem to find it.

Thx.

-Ralph

BTW: when are you going to improve your documentation??  :)
0
Jack
Telerik team
answered on 27 Jan 2012, 02:16 PM
Hello Ralph,

Clicking on the "Add new row" link changes the current row, so you can handle the CurrentRowChanged event:
void radGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
{
    if (e.CurrentRow is GridViewNewRowInfo)
    {
        //...
    }
}

However, I think that in you case the DefaultValuesNeeded event is more suitable. It fires when adding a new row, just before entering edit mode:
void radGridView1_DefaultValuesNeeded(object sender, GridViewRowEventArgs e)
{           
    e.Row.Cells["ID"] = GenerateNewID();
    //...
}

If this does not help, please describe in detail the behavior that you want to achieve and I will be glad to help further.

We constantly try to improve our documentation and we appreciate any specific suggestions that you may have.
 
All the best,
Jack
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Tags
GridView
Asked by
Vincent Willems
Top achievements
Rank 2
Answers by
Jack
Telerik team
Ralph
Top achievements
Rank 1
Share this question
or