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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

110676 Aug 20,2013 11:20 AM Aug 22,2013 06:07 AM ASP.NET MVC (Classic) 2
loading
Tags: Grid
Arvind
Asked On August 20, 2013 11:20 AM

@(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");

})


Arvind
Replied On August 20, 2013 11:28 AM

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?

Ajith R [Syncfusion]
Replied On August 22, 2013 06:07 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;