We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to retrieve row information in Context Menu's "OnContextMenuItemClick"

@(Html.Syncfusion().Grid<

ViewMandate>("MandateList")

.Datasource(Model)

.Caption(

"Mandates")

.AutoFormat(

Skins.Olive)

.Column(column =>

{

column.Add(m => m.MandateID).HeaderText(

"MandateID").Visible(false);

column.Add(m => m.Name).HeaderText(

"Mandate Name").Format("<a rel='nofollow' href=\"/Search/VersionSearch?mID={MandateID}&mNString={Name}\">{Name}</a>"); //.Format("<a rel='nofollow' href=\"javascript:OnVersionSearchClick('{MandateID}', '{Name}')\">{Name}</a>");

column.Add(m => m.DocumentOwnerUser).HeaderText(

"Mandate Owner");

column.Add(m => m.SeniorManagerUser).HeaderText(

"Senior Manager");

column.Add(m => m.EffectiveDate).HeaderText(

"Effective Date");

column.Add(m => m.VersionNumber).HeaderText(

"Version Number");

column.Add(m => m.LastApprovedDate).HeaderText(

"Last Approved Date");

column.Add(m => m.LastModifiedDate).HeaderText(

"Last Modified Date");

column.Add(m => m.Status).HeaderText(

"Mandate Status");

column.Add(

"ChangeLog").HeaderText("View Change Log").Format("<a rel='nofollow' href=\"javascript:OnChangeLogButtonClick('{MandateID}')\"><img src=\"/Content/themes/base/images/binocular-small.png\"</a>");

})

.EnableSorting()

.EnableFiltering()

.EnableAlternateRowStyling()

.EnableRowHover(

true)

.AllowSelection(

true)

.EnableContextMenu()

.ContextMenuItems(items =>

{

//items.Add(new ContextMenuItem() { Item = ContextMenuItems.Custom, HeaderCss = "PDFExport", TargetElement = GridElements.Record, Text = "Get Latest Version" });

items.Add(

new ContextMenuItem() { Item = ContextMenuItems.Custom, HeaderCss = "GetSpecificVersion", TargetElement = GridElements.Record, Text = "Get Specific Version" });

})

.ClientSideEvents(events =>

{

events.OnRecordSelectionEvent(

"OnMandateSelected");

//events.OnContextMenuOpen("OnVersionSearchClickTest");

events.OnContextMenuItemClick(

"OnVersionSearchClickTest");

})


2 Replies

AR Arvind August 20, 2013 03:28 PM UTC

When I click on "Get Specific Version" in the ContextMenu, I want to open a pop-up window and pass some of the information of the row in the grid to it. The model I'm using to bind the data has a porperty called ID. How do I retrieve the ID in "OnContextMenuItemClick". Is there any other way to get the ID value?


AR Ajith R Syncfusion Team August 22, 2013 10:07 AM UTC

Hi Arvind,

 

Thanks for using Syncfusion products.

 

Query : How to get a specific record from grid to popup widow when context menu item clicked?

 

We suggest you to get  the selected records from the sender by using get_SelectedRecords method and get the value of the record  based on its column name. Please refer the below code snippet for further details.

 

[script]

 

<script type="text/javascript">

    function ItemClick(sender, args) {

        alert("University Code : " + sender.get_SelectedRecords()[0].UniversityCode);

    } 

</script>

 

Please refer the below link to download the sample.

 

Please let us know if you have any concerns.

 

Regards,

 

Ajith R



Sample_e3035cb4.zip

Loader.
Live Chat Icon For mobile
Up arrow icon