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

Adding items to the HeaderContextMenu

2 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 30 Oct 2010, 09:54 PM
I have tried several attempts to add a item to the HeaderContextMenu. I was able to add a item utilizing this method
 
Protected Overloads Overrides Sub OnPreRenderComplete(ByVal e As EventArgs)
          
        Dim menu As RadContextMenu = rgvSchedules.HeaderContextMenu 
        Dim item As New RadMenuItem()
        item.Text = "Paste Results"
        item.PostBack = True
        menu.Items.Add(item)
        MyBase.OnPreRenderComplete(e)
    End Sub

The Postback method is because I was attempting to find a way to set a server side procedure on click. I removed the excess code from my failed attempts. There inlies the problem. I cannot for the life of me find a way to set the onclick method for the item that I added and when it is clicked I get a runtime error:

Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

2 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 04 Nov 2010, 11:15 AM
Hello Thomas,

Please, try the solution offered in this forum post. I tried it on my side and it worked as expected. Take notice of the events where the item add logic is performed.

Greetings,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Thomas
Top achievements
Rank 1
answered on 23 Nov 2010, 09:28 PM
Thank you. Based on that example I was able to accomplish what I wanted to do.
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or