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

Click more than once in Quick Add , and replace the current Row by blank row.

3 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
July
Top achievements
Rank 2
July asked on 18 Nov 2011, 08:30 PM
I attach 2 images.
 
I have a grid, with to buttons : Quick add (is the same that add new record) insert new row in grid.
Add Full add (open a modal popup)

Steps:
1- Add new record using inline Add (quick add).
2- Fill some fields.
3- Click again in Quick Add.
And the first row info desapear.

I need between item 2 and 3, add some Confirm Widows such as:
The current row will be delete. Are you sure? with OK and Cancel.
If click on OK --> continue with Insert
if click on cancel --> keep the row and not insert.

Where and How I can do this??

Image 1 --> Items 1 and 2
Imgae 2 --> error, lost the current row!

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 23 Nov 2011, 09:47 AM
Hello Julieta,

You can handle the grid OnCommand client-side event and the check if the insert item is already open. Then show the confirm and if the user selects Cancel, cancel the int insert command.
Check the attached sample and let me know if it helps.

Kind regards,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
July
Top achievements
Rank 2
answered on 28 Nov 2011, 01:26 PM
I need this un C#
  //if (eventArgs.get_commandName() == "InitInsert" && eventArgs.get_tableView().get_isItemInserted()) {
        //    if (!confirm("Are you sure?")) {
        //        eventArgs.set_cancel(true);
        //    }
        //}

I dont find IsItemInserted...
  if( e.CommandName == "InitInsert" && e.Item.IsInEditMode)
       {
        
0
Accepted
Iana Tsolova
Telerik team
answered on 28 Nov 2011, 04:33 PM
Hi Julieta,

It will be hard to display the alert from the server and implement the same logic server-side. Otherwise to cancel the command server-side, you can handle the ItemCommand event as below:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.InitInsertCommandName && e.Item.OwnerTableView.IsItemInserted)
    {
        e.Canceled = true;
    }
}


All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
July
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
July
Top achievements
Rank 2
Share this question
or