HeaderContextMenu OnItemClick firing issue

7 posts, 0 answers
  1. Devanand Jha
    Devanand Jha avatar
    16 posts
    Member since:
    Jul 2009

    Posted 25 Aug 2009 Link to this post

    Hi,

    I want to enable DragToGroup option of Radgrid from Context menu. For this i have added new option in HeaderContextmenu's prerender event. My grid is in UserControl so cant use OnPreRenderComplete page event. 

    I have added HeaderContextMenu onitemClick handler to enable DragToGroup option of radGrid, but its not firing. 

    protected

     

    void HeaderContextMenu_PreRender(object sender, EventArgs e)

     

    {

     

    RadContextMenu menu = wgEntityList.HeaderContextMenu;

     

     

    RadMenuItem item = new RadMenuItem();

     

    item.Text =

    "Group by text";

     

    menu.Items.Add(item);

    }

    protected

     

    void HeaderContextMenu_ItemClick(object sender, RadMenuEventArgs e)

     

    {

    wgEntityList.ClientSettings.AllowDragToGroup =

    true;

     

    }


    Please help me to get this event fire.

    Regards
    Devanand Jha




  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Aug 2009 Link to this post

    Hi Devanand,

    Give a try with the following approach and see whether it helps.

    CS:
     
     protected void Page_Load(object sender, EventArgs e) 
        { 
            RadGrid1.HeaderContextMenu.PreRender += new EventHandler(HeaderContextMenu_PreRender);
            RadGrid1.HeaderContextMenu.ItemClick += new RadMenuEventHandler(HeaderContextMenu_ItemClick); 
        } 
     
        void HeaderContextMenu_PreRender(object sender, EventArgs e) 
        { 
            RadContextMenu menu = RadGrid1.HeaderContextMenu; 
            RadMenuItem item = new RadMenuItem(); 
            item.Text = "Group by text"
            item.Attributes["ColumnName"] = string.Empty; 
            item.Attributes["TableID"] = string.Empty; 
            item.PostBack = true
            menu.Items.Add(item); 
            
        } 
       
     
        void HeaderContextMenu_ItemClick(object sender, RadMenuEventArgs e) 
        { 
            RadGrid1.ClientSettings.AllowDragToGroup = true
        } 


    Regards
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Devanand Jha
    Devanand Jha avatar
    16 posts
    Member since:
    Jul 2009

    Posted 25 Aug 2009 Link to this post

    Hi Princy,

    Thanks for reply.

    It's not working.

    Regards
    Devanand Jha
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Aug 2009 Link to this post

    Hi Deva,

    The above given code is working fine on my end. Could you please send the code portion where you are adding the event handler for the ItemClick and PreRender events of the HeaderContextMenu.

    Princy

  6. Devanand Jha
    Devanand Jha avatar
    16 posts
    Member since:
    Jul 2009

    Posted 26 Aug 2009 Link to this post

    Hi Princy,

    I am adding these events handlers at PageLoad.

    protected

     

    void Page_Load(object sender, EventArgs e)

     

    {

    RadGrid1.HeaderContextMenu.PreRender +=

    new EventHandler(HeaderContextMenu_PreRender);

     

    RadGrid1.HeaderContextMenu.ItemClick +=

    new RadMenuEventHandler(HeaderContextMenu_ItemClick);

     

    }

    Regards,
    Devanand Jha

  7. Kyle Jang
    Kyle Jang avatar
    1 posts
    Member since:
    Apr 2010

    Posted 29 Apr 2010 Link to this post

    Hi Princy,

    I have exactly same issue. When I debug in IE8, VS2010, it stops at middle of huge javascript and doesn't fire that event.

    Error:
    Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

    Please help.
    Thanks,
    Kyle
  8. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017