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

Confirmation does not work on RadMenuItem

2 Answers 98 Views
Menu
This is a migrated thread and some comments may be shown as answers.
johnson lim
Top achievements
Rank 1
johnson lim asked on 06 May 2010, 09:10 AM
Hi, i have a RadContextMenu which is created dynamically.The RadMenuItem inside it is also created dynamically.
My RadMenuItem which may consists of Edit/ Delete/Firm.When user click on the Firm or Delete , a pop up come out for confirmation. When user choose ok only, then it proceed to firm or delete the record.

My problem is no matter user click on the ok or cancel button the  RadMenu.ItemClick evet is fired.
Does anyone has idea on this??
Below is my coding :
    Private Sub CreateDynamicControl() 
 
        Dim i As Integer 
        Dim iCellIndex As Integer 
        Dim drFoundRecord As Data.DataRow() 
 
        Try 
 
            For i = 0 To gvDynamic.Rows.Count - 1 
                For iCellIndex = 1 To gvDynamic.Rows(i).Cells.Count - 1 
                    If gvDynamic.Rows(i).Cells(iCellIndex).ID Is Nothing = False Then 
 
                        Dim cLabelItem As New Label 
                        Dim cTxtboxQty As New TextBox 
                        Dim cLabelWorkOrder As New Label 
                        Dim cTxtWorkOrder As New TextBox 
 
                        Dim cLiteraSpace1 As New LiteralControl 
                        Dim cLiteraSpaceBR As New LiteralControl 
                        Dim cLiteraSpace2 As New LiteralControl 
                        Dim cHtmlTable As New HtmlTable 
 
                        Dim radMenu As New Telerik.Web.UI.RadContextMenu 
                        Dim radMenuItem As New Telerik.Web.UI.RadMenuItem 
                        Dim radMenuItem2 As New Telerik.Web.UI.RadMenuItem 
                        Dim radMenuItem3 As New Telerik.Web.UI.RadMenuItem 
                        Dim target As New Telerik.Web.UI.ContextMenuControlTarget 
 
 
 
 
                        Dim button1 As New Button 
 
 
                        drFoundRecord = getRecordByKey(gvDynamic.Rows(i).Cells(iCellIndex).ID) 
 
                        If drFoundRecord.Length > 0 Then 
 
                            cHtmlTable = CreateDynamicHTMLTable() 
 
                            gvDynamic.Rows(i).Cells(iCellIndex).BackColor = Drawing.Color.BlanchedAlmond 
 
                            cLabelItem.ID = "lblItem" & gvDynamic.Rows(i).Cells(iCellIndex).ID 
                   
                            cLabelItem.Text = drFoundRecord(0)("Planned_Item") 
                          
                            radMenuItem.Text = "Edit" 
                            radMenuItem2.Text = "Delete" 
                            radMenuItem3.Text = "Firm" 
 
                            radMenu.Items.Add(radMenuItem) 
                            radMenu.Items.Add(radMenuItem2) 
                            radMenu.Items.Add(radMenuItem3) 
 
                            radMenuItem3.Attributes.Add("onclick", "return confirm('Are you sure you want to firm?');") 
                            radMenuItem2.Attributes.Add("onclick", "return confirm('Are you sure you want to delete?');") 
 
                            AddHandler radMenu.ItemClick, AddressOf cRadMenuItem1Click 
 
                            target.ControlID = cLabelItem.ID 
 
                            radMenu.Targets.Add(target) 
 
 
                            cHtmlTable.Rows(0).Cells(0).Controls.Add(radMenu) 
                            cHtmlTable.Rows(0).Cells(0).Controls.Add(cLabelItem) 
                
                            gvDynamic.Rows(i).Cells(iCellIndex).Controls.Add(cHtmlTable) 
 
                        End If 
 
                    End If 
                Next 
            Next 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
 
 
    Protected Sub cRadMenuItem1Click(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMenuEventArgs) 
 
        Try 
 
            Dim a As String 
            a = "sfds" 
 
 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
TQ

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 06 May 2010, 09:50 AM
Hi johnson lim,

Please check this kb article which shows how to use radconfirm with navigational controls.

All the best,
Yana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Silvio Silva Junior
Top achievements
Rank 2
answered on 22 Feb 2014, 01:24 AM
Thanks!

Regards.
Tags
Menu
Asked by
johnson lim
Top achievements
Rank 1
Answers by
Yana
Telerik team
Silvio Silva Junior
Top achievements
Rank 2
Share this question
or