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

Cancel Button in Edit Mode

2 Answers 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
aj
Top achievements
Rank 1
aj asked on 11 Jul 2012, 02:25 PM

Good morning guys, I'm currently stuck on a particular problem here.
Currently on edit mode I have a procedure for the "Update" button to execute a procedure (done via the wizard)

Now I'm trying to add a stored procedure on the "Cancel" button. I need to validate some data

Can I add the command here ?
Kindly please help? I know this is easy for experts out there

If e.Item.IsInEditMode Then

 

 

 

 

 

 

If TypeOf e.Item Is GridDataInsertItem Then

 

 

 

 

 

 

Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)

 

 

Dim InsertButton As ImageButton = DirectCast(editItem.FindControl("PerformInsertButton"), ImageButton)

 

 

Dim CancelButton As ImageButton = DirectCast(editItem.FindControl("CancelButton"), ImageButton)

 

CancelButton.Visible =

True

 

 

 

 

 

 

Else

 

 

 

 

 

 

Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)

 

 

Dim updateButton As ImageButton = DirectCast(editItem.FindControl("UpdateButton"), ImageButton)

 

 

Dim CancelUpdateButton As ImageButton = DirectCast(editItem.FindControl("CancelButton"), ImageButton)

 

CancelUpdateButton.Visible =

True

 

 

 

 

 

 

End If

 

 

 

 

 

 

End If


Thanks in advance :)

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Jul 2012, 05:05 AM
Hi,

You can set CommandName to the cancel button.Please take a look into the following code snippet.

VB:
Protected Sub RadGridTicketDetails_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs)
    If e.Item.IsInEditMode Then
 
        If TypeOf e.Item Is GridDataInsertItem Then
            Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
            Dim InsertButton As ImageButton = DirectCast(editItem.FindControl("PerformInsertButton"), ImageButton)
            Dim CancelButton As ImageButton = DirectCast(editItem.FindControl("CancelButton"), ImageButton)
            CancelButton.Visible = True
        Else
            Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
            Dim updateButton As ImageButton = DirectCast(editItem.FindControl("UpdateButton"), ImageButton)
            Dim CancelUpdateButton As ImageButton = DirectCast(editItem.FindControl("CancelButton"), ImageButton)
            CancelUpdateButton.Visible = True
                'Add CommandName Here
            CancelUpdateButton.CommandName = "Close"
        End If
    End If
 
End Sub

Thanks,
Shinu.
0
aj
Top achievements
Rank 1
answered on 12 Jul 2012, 01:16 PM
Really not sure how to proceed :(
Let me see if I can google that.
Tags
Grid
Asked by
aj
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
aj
Top achievements
Rank 1
Share this question
or