Piyush Vardhan
Top achievements
Rank 1
Piyush Vardhan
asked on 22 May 2008, 08:03 AM
Hello Friends
How Can i dynamic add item in context menu and open Context Menu on Grid row click by javascript .
How Can i dynamic add item in context menu and open Context Menu on Grid row click by javascript .
4 Answers, 1 is accepted
0
H Piyush,
Please check the AJAX-enabled context menu in grid for an example of how to create a context menu for RadGrid and the Add, remove, disable menu items for a demonstration of the client-side RadMenu API, related to item management.
I hope this helps.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please check the AJAX-enabled context menu in grid for an example of how to create a context menu for RadGrid and the Add, remove, disable menu items for a demonstration of the client-side RadMenu API, related to item management.
I hope this helps.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Piyush Vardhan
Top achievements
Rank 1
answered on 22 May 2008, 08:43 AM
Thanks For Reply Friend
I want when i click or right click on row of grid then context menu open with value of(
) in context Menu through Ajax or Javascript .i want dinamic Context menu which Create on click of grid row. r u getting me what i want? i
I want when i click or right click on row of grid then context menu open with value of(
QuantityPerUnit | UnitPrice | UnitsInStock |
---|
0
Jorge Gracia
Top achievements
Rank 1
answered on 01 Aug 2012, 02:37 PM
I have a very similar need.
Require a context menu were its items change based on where the users right clicks.
Require a context menu were its items change based on where the users right clicks.
0
Princy
Top achievements
Rank 2
answered on 02 Aug 2012, 07:48 AM
Hello,
I suppose you want to show different RadContextMenu for different target controls. Following is the sample code.
ASPX:
JS:
Hope this helps.
Regards,
Princy.
I suppose you want to show different RadContextMenu for different target controls. Following is the sample code.
ASPX:
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
AutoPostBack
=
"false"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButton2"
runat
=
"server"
AutoPostBack
=
"false"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButton3"
runat
=
"server"
AutoPostBack
=
"false"
>
</
telerik:RadButton
>
<
telerik:RadContextMenu
ID
=
"RadContextMenu1"
runat
=
"server"
OnClientShown
=
"OnClientShown"
>
<
Targets
>
<
telerik:ContextMenuControlTarget
ControlID
=
"RadButton1"
/>
<
telerik:ContextMenuControlTarget
ControlID
=
"RadButton2"
/>
<
telerik:ContextMenuControlTarget
ControlID
=
"RadButton3"
/>
</
Targets
>
</
telerik:RadContextMenu
>
JS:
<script type=
"text/javascript"
>
function
OnClientShown(sender, args) {
var
k = sender.get_items().get_count();
for
(i = 0; i <= k; i++) {
sender.trackChanges();
sender.get_items().removeAt(0);
sender.commitChanges();
}
if
(args.get_targetElement().name ==
"RadButton1"
) {
var
item1 =
new
Telerik.Web.UI.RadMenuItem();
item1.set_text(
"item1"
);
var
item2 =
new
Telerik.Web.UI.RadMenuItem();
item2.set_text(
"item2"
);
var
item3 =
new
Telerik.Web.UI.RadMenuItem();
item3.set_text(
"item3"
);
sender.trackChanges();
sender.get_items().add(item1);
sender.get_items().add(item2);
sender.get_items().add(item3);
sender.commitChanges();
}
else
if
(args.get_targetElement().name ==
"RadButton2"
) {
var
item1 =
new
Telerik.Web.UI.RadMenuItem();
item1.set_text(
"item4"
);
var
item2 =
new
Telerik.Web.UI.RadMenuItem();
item2.set_text(
"item5"
);
var
item3 =
new
Telerik.Web.UI.RadMenuItem();
item3.set_text(
"item6"
);
sender.trackChanges();
sender.get_items().add(item1);
sender.get_items().add(item2);
sender.get_items().add(item3);
sender.commitChanges();
}
else
if
(args.get_targetElement().name ==
"RadButton3"
) {
var
item1 =
new
Telerik.Web.UI.RadMenuItem();
item1.set_text(
"item7"
);
var
item2 =
new
Telerik.Web.UI.RadMenuItem();
item2.set_text(
"item8"
);
var
item3 =
new
Telerik.Web.UI.RadMenuItem();
item3.set_text(
"item9"
);
sender.trackChanges();
sender.get_items().add(item1);
sender.get_items().add(item2);
sender.get_items().add(item3);
sender.commitChanges();
}
}
</script>
Hope this helps.
Regards,
Princy.