I'm trying to make it so that a column in an ultragrid is formatted like a hyperlink -- the text shows up as a link, and when you hover over it, the cursor changes to a hand. When clicked, I would like to handle the click event, just like I can handle the button click if the column style is 'Button'. I have set the column style to 'URL', but I can't figure out how to handle the hyperlink click event.
I found some posts which indicate that I must add an UltraFormattedTextEditor to the form, and set the EditorComponent property of the UltraGrid column to reference the UltraFormattedTextEditor instance. However, I don't know where to go from there. I have put code in the 'LinkClicked' event of the UltraFormattedTextEditor, but that code never runs no matter what I do. Even if I click a link I created directly in the UltraFormattedTextEditor on the form (which, I might say, I ultimately dont' want to have to show on the form, neither in the designer nor at runtime), the event doesn't fire. In fact, it only looks like a link, but when you hover over it, it doesn't show the hand cursor.
I'm totally confused. There must be an easier way to get this accomplished. I'm using 2010.3 version of the product.
Hello ,
What you could do in your case is to use UltraFomrmattedTextEditor as editor of your link column, also you should configure your UltraFomrmattedTextEditor ContextMenuItems to allow link editing. I have implemented this suggestion in a small sample (double click on the cell (not on the link ) in order to enter in edit mode, then right click on the link and select “Link Settings.. ”).
I hope that this will helps you.
when I do that I can't change the URL anymore. the cell becames readonly >:-/
is there an option where if I click it goes to edit mode and if I press Ctrl+click it executes the url?
Thanks!
Never mind... I found the issue... developer error ;) I tried to remove my previous post but the site won't let me today.. Thanks anyway!
I am trying this code, but after it executes the 3rd line to assign the editor, editor is still null.. Hence, the 4th line fails with a nullreferenceexception.. Does anyone have any ideas? I'm sure this is something simple, but I can't find it...
After setting the column style to URL the column's editor property will return an instance of the FormattedLinkEditor class. That editor exposes a LinkClicked event, which you can handle like so:
UltraGridColumn column;column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.URL;Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor editor = column.Editor as Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor;editor.LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(editor_LinkClicked);