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 :
TQ
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 |