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

custom deleting

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 19 Sep 2008, 08:15 PM
I'm looking for a custom row deleting solution. When the user clicks to delete an item from the grid, the item will expand and the user can enter a reason that they are deleting.

I currently already have an edit option in the grid, so my thought was to have multiple edit buttons (one for the actual edit and the other for the delete) that opens different edit forms. Is  this a viable option? Are there any preexisting resources on this?

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Sep 2008, 09:58 AM
Hello Roger,

You can set different CommandArguments for the buttons and based on these properties change the UserControl form for each button.
aspx:
 <telerik:GridButtonColumn CommandName="Edit" ButtonType="LinkButton" Text="Edit" CommandArgument="Edit"
            </telerik:GridButtonColumn> 
 <telerik:GridButtonColumn CommandName="Edit" ButtonType="LinkButton" Text="Delete" CommandArgument="Delete">             
            </telerik:GridButtonColumn> 

cs:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
          if (e.CommandArgument == "Edit") 
        { 
            e.Item.OwnerTableView.EditFormSettings.UserControlName = "EditFormUserControl.ascx"
        } 
        else if (e.CommandArgument == "Delete") 
        { 
            e.Item.OwnerTableView.EditFormSettings.UserControlName = "ReasonUserControl.ascx"; 
        } 
   } 
 

Princy.
0
Roger
Top achievements
Rank 1
answered on 22 Sep 2008, 03:18 PM
That works perfectly. As an additional note to the code: yes, you do have to create web user controls with the names that you give in your C#
Tags
Grid
Asked by
Roger
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Roger
Top achievements
Rank 1
Share this question
or