Hi,
i my WinGrid i have a column which is ColumnStyle.URL
If the cell contains the local path (c:\xyz\abc) then clicking opens the windows explorer with the folder abc.
Now i want to display only the folder in the cell (abc) and not the whole path.
So i added the following code in order to get a LinkClicked event:
Infragistics.Win.UltraWinGrid.UltraGridColumn colDownload = ugrdSender.DisplayLayout.Bands[0].Columns["DownloadFolder"];colDownload.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.URL;Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor editorDownload = colDownload.Editor as Infragistics.Win.FormattedLinkLabel.FormattedLinkEditor;editorDownload.LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(editorDownload_LinkClicked);
The event ist defined:
private void editorDownload_LinkClicked(object sender, Infragistics.Win.FormattedLinkLabel.LinkClickedEventArgs e) { e.LinkText = "c:\\abc\\" + e.LinkText; }
But e.LinkText seems to be ReadOnly??
How can i add the basepath (C:\xyz) bevor the Link opens the explorer ..?
thanks for every idea!!!
Torsten
Hello Torsten,
What you can do is set the column style to FomattedText. Then, instead of setting the Text of the cell to the folder name, e.g. “abc”, set it to formatted text. In your case you may set the Text of the cell to something like this:
<a href=”c:\xyz\abc”>abc</a>
To make it easier you may use some custom method to create the formatted link text for the cells. For example to create simple link use method like this:
private string GetFormattedLink(string viewText, string linkText){ return string.Format("<a href=\"{0}\">{1}</a>", linkText, viewText);}
Please check our online documentation for additional information about formatting text and hyperlinks.
In the attached sample project, I have implemented this approach. Please check my sample and let me know if you have any additional question.
Hi Milko,
yes that's it.
I changed style and the cell gets the href statement.
So it works fine without any custom addition ;-)
simple and clean!!
Thank's again!!