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
300
Wingrid FormattedText management
posted

Hi,

I need some help. I'm trying to manage several links in a cell in a wingrid. The content of the cell should appear as

Items #1#2 are about to expire

What I've done is to set the style property of the column to FormattedText and fill in the cell value with

Items <a href="formToOpen|1">#1/a>, <a href="formToOpen|2">#21/a> are about to expire

 

The cell is shown as exepected, but my problem is how to get the href info, as it will be used to open the proper form.

This is the code I have

Dim aUIElement As Infragistics.Win.UIElement
aUIElement = grdTemplateFormSearch.DisplayLayout.UIElement.ElementFromPoint( _
New Point(e.X, e.Y))


And here I can watch the info I need but as NodeText is friend I cannot reference it by code DirectCast(DirectCast(DirectCast(DirectCast(aUIElement.GetContext(GetType(Infragistics.Win.FormattedLinkLabel.NodeText)), System.Object), Infragistics.Win.FormattedLinkLabel.NodeText).Parent, Infragistics.Win.FormattedLinkLabel.NodeBase), Infragistics.Win.FormattedLinkLabel.NodeAnchor).HRef()

Which should be the appropiate way to findout the href data?

Many thanks in advance

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    I think you are going about this the hard way. You do not need to use ElementFromPoint.

    What you should do is place an UltraFormattedLinkLabel control on the form with the grid. Then you set the Column's EditorComponent properto to the UltraFormattedLinkLabel.

    This is essentially the same as settings the Style on the column - so you no longer need to do that.

    Then you can handle the LinkClicked event on the UltraFormattedLinkLabel and it gives you the link text and link reference.


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                //e.Layout.Bands[0].Columns[0].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText;
                e.Layout.Bands[0].Columns[0].EditorComponent = this.ultraFormattedLinkLabel1;
            }

            private void ultraFormattedLinkLabel1_LinkClicked(object sender, Infragistics.Win.FormattedLinkLabel.LinkClickedEventArgs e)
            {           
                e.OpenLink = false;
                MessageBox.Show(this, e.LinkText, e.LinkRef);
            }

Children
No Data