using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        AddControlToExpandColumn(RadGrid1.MasterTableView);
    }
    public void AddControlToExpandColumn(GridTableView tableView)
    {
        GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);
        foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
        {
            foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
            {
                TableCell cell = nestedView.ParentItem["ExpandColumn"];
                ImageButton contextButton = new ImageButton();
                contextButton.ImageUrl = "menu.png";
                contextButton.OnClientClick = "RowContextMenu(this,event);return false;";
                contextButton.CssClass = "myStyle";

                cell.Controls.Add(contextButton);
                cell.Width = Unit.Pixel(35);
            }
        }
    }

    protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
    {
        // execute custom logic according to user's selection
    }
}
