Saturday, 29 January 2011

Adding a RadContextMenu to a Command Button in RadGridView

Out-of-the-box, the RadGridView does a really good job of manking context menus in the RadGridView a simple process by handling the ContextMenuOpening event handler.

If however you have a GridViewCommandColumn in your RadGridView and you want to add a context menu to your command button, then the ContextMenuOpening event doesn't fire for this, as the command button is a RadButtonElement inside the CellElement.

it is though, quite a simple process to add a RadContextMenu to a command button.

  • Subscribe to the CellFormatting event and add a MouseDown event handler on the command button

    Private Sub RadGridView1_CellFormatting(ByVal sender As System.Object,
                                            ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.CellFormatting

        If TypeOf e.CellElement Is GridCommandCellElement Then
            If e.CellElement.Tag Is Nothing Then
                AddHandler CType(e.CellElement, GridCommandCellElement).CommandButton.MouseDown, AddressOf Button_MouseDown
            End If
            e.CellElement.Tag = True
        End If
    End Sub

  • Handle the MouseDown event, and create your context menu
    Private Sub Button_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
        If e.Button = MouseButtons.Right Then
            Dim menu As New RadContextMenu()

            Dim item1 As New RadMenuItem("Menu Item 1")
            RemoveHandler item1.Click, AddressOf Item_Click
            AddHandler item1.Click, AddressOf Item_Click
        End If
    End Sub

  • And lastly, handle the click of the context menu
    Private Sub Item_Click(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("You clicked the item menu in row: " & Me.RadGridView1.CurrentRow.Index.ToString() &
       " cell: " & Me.RadGridView1.CurrentColumn.Index.ToString())
    End Sub

Friday, 28 January 2011

Error 1001. Error 1001. Unable to get installer types in the assembly. --> Unable to load one or more of the requested types

today, a non-Telerik blog post,

We have several Visual Studio solutions here. Some are .NET 4.0, and some are .NET 2.0. The one that we were having an issue with was an older .NET 2.0 solution that we decided to start developing in Visual Studio 2010, but still targeting the .NET 2.0 runtime.

No changes were made to the projects in the solution. We just re-compiled in Visual Studio 2010. However, when we came to run the install, it would fail with the following error message:

Error 1001. Error 1001. Unable to get installer types in the assembly. --> Unable to load one or more of the requested types

There are several ways of finding out what the issue is here though we were up against a tight deadline. The issue though I think is due to the main executable in the solution having an installer file and therefore a custom action in the set up project. Even though the target framework is still .NET 2.0, the resulting Setup.exe and msi were different sizes to those produced under VS2005. The solution was to start a new blank solution and re-import all the .NET 2.0 projects back into that again. The installation then went through with no issues first time.

Hope that helps someone.

Wednesday, 26 January 2011

Getting the most from Telerik Support (re-post from Stefan at Telerik)

I happened upon the following on Telerik's Facebook page which was published by Stefan, but thought it had some great information that I would regurgitate here.

Stefan writes...

The two main routes you can take to get assistance from the Telerik Support Staff are pretty well-known: posting an inquiry in the Telerik public forum or creating a support ticket. It is up to you to decide which of these two paths to choose and that is why I would like to underline that the purpose of the next paragraphs is to provide general guidelines instead of influencing directly your choice.

Forum Posts
The forum posts have 72 hours response time and this is the place where you can get answers from the Telerik Support Staff as well as from Telerik community members. The discussions there are public and can be browsed/searched by other site visitors. In addition, you can use the support search facilities on to find answers to your questions quickly and without the need to wait until someone responds to them.
Although around 95% of the forum posts are handled by Telerikers, the response time in the forums is not 100% guaranteed. General instructions about how to use the Telerik forums can be found here.

*Note: People answering questions in the forums (with replies marked as answers) can earn Telerik points or MVP tokens which can be used for future discounts when upgrading/purchasing our controls or gain Telerik MVP status respectively. This stimulates developers to help each-other and thus becomes a 'natural extension' of the Telerik support service.

Support Tickets
On the other hand, the support tickets are the private channel which you can use to communicate with Telerik (for support-related questions). The response time in them depends on the support package you received with your purchase. Furthermore, the support tickets are considered with higher priority over the forum threads and allow code file attachments as opposed to the forums which permit image attachments only.

There are also several mandatory fields you have to fill in when creating a support ticket (after choosing a particular Telerik product) and specifying those correctly can be very important for replicating your case and tracking down a particular issue. They are present in 'Step1: Software you are using' on the Support Tickets-> Write Support Ticket page. Another important part of your message is the description itself - it should provide all the necessary details and outline your main configuration settings. Including code snippets, screenshots, videos, stack trace of exceptions or stand-alone sample project can speed up the resolution (their effectiveness may vary depending on the actual case). Those are entered in 'Step2: Describe your question' on the same page specified above.

Below are some extra 'in-house' tips I would like to share that are quite useful and turn out to be real time-savers in our daily support communication:

1.Do not include Telerik controls assemblies in sample projects attached to tickets - instead select the exact version of the respective dlls from the dropdown when starting the support thread. This will spare 5 to 6MB being uploaded/downloaded afterwards. For instance, see how to check the exact version of Telerik.Web.UI.dll here.
2.Screenshots - avoid using .bmp format, instead convert the images to .png or .jpeg to reduce their size
3.Do not reply to automated emails which notify that your support ticket/forum post has been answered. Post replies in support tickets/forum threads only. Use merely those two support channels for technical questions (instead of writing to or - thus your support history can be easily tracked and your questions will reach the relevant support personnel faster.
4.You may share video content using Jing to avoid uploading videos in a support ticket.
5.Strip down as much custom code from sample projects as possible and remove any unnecessary/unrelated dependencies. In case you work under DotNetNuke, Sharepoint or other custom environment, check whether there are any differences in the code execution inside and outside of that environment. When you are not able to share the data source due to some reason (db policies, NDA, etc.), consider generating a dummy/sample data source for testing purposes. This, for example, can be manually generated asp DataTable in case your control is data-bound.

Once again, I stress on the fact that it is your decision whether you will use the private support system or the public forums to share this information and get an answer/feedback from us. Of course, the fastest means to find answers/solutions is to dive into the vast support resources available on our site following the tips from these sources:


Blog Post

Thursday, 13 January 2011

Exchange your Telerik Skins and Themes

Many people know about the Telerik Code Library, a place where you can post code samples to share with the Telerik community.

Most people though don't know that you can also do the same with your skins and themes. The Telerik Skin Exchange Program allows users to post skins and themes for RadControls for WinForms and ASP.NET. If you've created a great new skin or theme, share it with the Telerik community.

Monday, 10 January 2011

Microsoft Active Accessibility and Telerik RadControls for WinForms

Microsoft® Active Accessibility® 2.0 is a COM-based technology that improves the way accessibility aids work with applications running on Microsoft Windows®. It provides dynamic-link libraries that are incorporated into the operating system as well as a COM interface and application programming elements that provide reliable methods for exposing information about user interface elements.

The good news for users of Telerik RadControls for WinForms is that Telerik plan to add full MSAA (Microsoft Active Accessibility) compatibility in Q1 2011, which will make the Telerik WinForms suite the first suite to be fully compliant with the latest user interface accessibility and UI automation standards.

For more information on upcoming features, visit the Telerik Roadmap

Tuesday, 4 January 2011

Upcoming Telerik Events

Codemash Ohio | Telerik
12 Jan 2011 – 14 Jan 2011
Sandusky , USA
Telerik will be a Platinum sponsor of the Codemash conference which takes place Jan 12 -14 at the Kalahari resort in Sandusky, OH.
Visit the Telerik booth to get some cool t shirts and learn more about our TeamProductivity and DeveloperProductivity tools.

Internet World London 2011 | Telerik
10 May 2011 – 12 May 2011
Telerik will exhibit at the 12th edition of Internet World – the biggest UK event for Digital Marketing, Web 2.0 & Social Media, eCommerce, Content Management & Hosting which will take place 10 - 12 May, 2011 at Earls Court 2 in London.

Agile Development and Testing India | Telerik
18 Jan 2011 – 18 Jan 2011
Pune , INDIA
Telerik will be organizing a free training on January 18, 2011 in Pune, India

For more information on all upcoming Telerik events, have a look at the Telerik Events Page