Confirmation does not work on RadMenuItem

3 posts, 0 answers
  1. johnson lim
    johnson lim avatar
    72 posts
    Member since:
    Feb 2010

    Posted 06 May 2010 Link to this post

    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. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 06 May 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Silvio Silva Junior
    Silvio Silva Junior avatar
    100 posts
    Member since:
    Mar 2010

    Posted 21 Feb 2014 in reply to Yana Link to this post

    Thanks!

    Regards.
Back to Top