This is a migrated thread and some comments may be shown as answers.

HeaderContextMenu OnItemClick firing issue

6 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Devanand Jha
Top achievements
Rank 1
Devanand Jha asked on 25 Aug 2009, 08:31 AM
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




6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 25 Aug 2009, 11:50 AM
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.
0
Devanand Jha
Top achievements
Rank 1
answered on 25 Aug 2009, 12:11 PM
Hi Princy,

Thanks for reply.

It's not working.

Regards
Devanand Jha
0
Princy
Top achievements
Rank 1
answered on 26 Aug 2009, 05:25 AM
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

0
Devanand Jha
Top achievements
Rank 1
answered on 26 Aug 2009, 09:51 AM
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

0
Kyle Jang
Top achievements
Rank 1
answered on 29 Apr 2010, 08:22 PM
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
0
Erik
Top achievements
Rank 2
answered on 12 Apr 2011, 08:30 PM
Tags
Grid
Asked by
Devanand Jha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Devanand Jha
Top achievements
Rank 1
Kyle Jang
Top achievements
Rank 1
Erik
Top achievements
Rank 2
Share this question
or