<TreeViewTemplates>
<NodeTemplate>
@{
var employee = ((context as EmployeeDetails));
<img id="@((@context as EmployeeDetails).EmployeeId)" class="eimage" src="@UriHelper.ToAbsoluteUri($"/{@employee.Image}.png")" @onclick="@((e) =>MemberFunction((@context as EmployeeDetails).EmployeeId, e))" />
<div class="ename">@((@context as EmployeeDetails).EmployeeName)</div>
<div class="ejob">@((@context as EmployeeDetails).Designation)</div>
}
</NodeTemplate>
</TreeViewTemplates> |
void MemberFunction(int args, MouseEventArgs args1)
{
// Set context menu item based on image id /*args- image id*/
if (args == 1)
{
menu.HideItems(this.RemoveItem);
menu.ShowItems(this.showItem);
}
else
{
menu.HideItems(this.showItem);
menu.ShowItems(this.RemoveItem);
}
//Open the context menu during click
menu.Open(args1.ClientY + 20, args1.ClientX + 10);
} |