Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
945
Handle URL Click in a Cell
posted

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.

Parents
  • 69832
    Verified Answer
    Offline posted

    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);

Reply Children