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.

Context menu doesn''t work for itemtemplate column

Thread ID:

Created:

Updated:

Platform:

Replies:

81097 May 12,2009 08:40 AM May 14,2009 09:58 AM ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On May 12, 2009 08:40 AM

If the column type is Item template then the context menu doesn't show up :(

Rekha P [Syncfusion]
Replied On May 14, 2009 09:58 AM

Hi Girish,

Thank you for your interest in Syncfusion Products.

We regret to let you know that currently it is not possible to show the context menu over the Item Templates. But as a workaround, please refer the sample below which illustrates of displaying Menu control as popup while hovering on image item template.

http://files.syncfusion.com/support/GGC.Web/7.103.0.21/55067/main.htm

Steps followed are:
1. Place Image and PopupControlContainer inside ItemTemplate.
2. Place Menu control inside PopupControlContainer.
3. For every row bounding, set corresponding MenuItem text, PopupControlContainer clientobjectid and attribute for image mouse over event.
4. Capture the popup clientobjectid using js function by evaluating it.

Please refer the code snippet below to achieve this.

[ASPX]



















[C#]

void GridGroupingControl1_RowDataBound(object sender, RowDataBoundEventArgs e)
{
if (e.Element.Kind == Syncfusion.Grouping.DisplayElementKind.Record)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
if (((GridCell)(e.Row.Cells[i])).ColumnDescriptor != null)
{
//check ItemTemplate column name
if (((GridCell)(e.Row.Cells[i])).ColumnDescriptor.Name == "Image")
{
Syncfusion.Web.UI.WebControls.Tools.Menu ContextMenu = (Syncfusion.Web.UI.WebControls.Tools.Menu)e.Row.Cells[i].FindControl("Menu1");
if (ContextMenu != null)
{
//bind text to MenuItem
ContextMenu.Items[0].Text = e.Row.Record.GetValue("Name").ToString();
}
Syncfusion.Web.UI.WebControls.Shared.PopupControlContainer PopUp = (Syncfusion.Web.UI.WebControls.Shared.PopupControlContainer)e.Row.Cells[i].FindControl("PopupControlContainer1");
if (PopUp != null)
{
//specify ClientObjectId of PopupControlContainer
PopUp.ClientObjectId = e.Row.Record.GetValue("Name").ToString();
}
System.Web.UI.WebControls.Image ContextMenuImage = (System.Web.UI.WebControls.Image)e.Row.Cells[i].FindControl("ContextMenuImage");
if (ContextMenuImage != null)
{
ContextMenuImage.Attributes.Add("onmouseover", "Showpopup('"+PopUp.ClientObjectId+"')");
}
}
}
}
}
}

[Javascript]

We can trigger the PopupControlContainer's ClientObjectId by evaluating the expression.



If you want to display the popup with corresponding hovered Image's, please use the below code.



For more information about PopupControlContainer, refer to ASP.Net --> Controls and Components --> Notification Package --> PopupControlContainer

http://help.syncfusion.com/ug_71/toolsweb/default.html

Please let me know if you have any concerns.

Thanks,
Rekha

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.

;