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

[Solved] Double CommandName

1 Answer 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis van Emmerik
Top achievements
Rank 1
Dennis van Emmerik asked on 06 Oct 2009, 02:02 PM

This is my problem.
I have this RadGrid with an EditFormTemplate (UserControl). With a button called "AddNew" we create a new row in the grid.
On the EditFormTemplate we want to have 3 buttons:
- Update
- Cancel
- Update and Insert New

The first two buttons was easy. Button with CommandName="Update" and CommandName="Cancel". These events are bubbled to the RadGrid and handled. The last button i'm lost on how this must be accumplished.
I've created a normal button and in the eventhandler i wrote: 

 

 

 

this.RaiseBubbleEvent(sender, new CommandEventArgs("Update", null));

 

this.RaiseBubbleEvent(sender, new CommandEventArgs("InitInsert", null));

This first event is handled by the RadGrid, but the second one isn't.
How can i create a button the updates the current edited row, and inserts a new one...?

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Oct 2009, 01:15 PM
Hello Dennis,

Try the following code snippet and see whether it helps.

C#:
 
bool check = false
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    if (e.CommandName == "UpdateInsert") //Set he CommandName as UpdateInsert
    { 
        ((Telerik.Web.UI.GridDataItem)(e.Item)).EditFormItem.FireCommandEvent("Update"""); 
        check = true
    } 
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
    if(check) 
    { 
        RadGrid1.MasterTableView.InsertItem(); 
    } 

Thanks,
Princy.
Tags
Grid
Asked by
Dennis van Emmerik
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or