Dear all,
How to make part of the text in the cells to be URL or HyperLink?? so that it will trigger the function with the URL Value??
e.g. Trans. No: 1234567890
Before I am using below with the whole cell.
private void dtgSalesTransactionsList_AfterCellActivate(object sender, EventArgs e)
Instead of setting he column Style, you need to place an UltraFormattedTextEditor or UltraFormattedLinkLablel on the form and attach it to the grid column using the EditorComponent property of the column.
You will probably want to use the label, since I imagine your cell will be read-only.
Anyway, you define the links the same say, but you can put any text you want in for the URL. Then you handle the LinkClicked event of the UltraFormattedLinkLablel. This event will fire when the user clicks a link in any cell and the event args will give you information about the link (including the URL you used) and then you can launch a form or do whatever you want.
Hi,
Actually I am not using http URL. I just open another windows form. How to do them??
You could also use a String column and set the Style to FormattedText. Then you set the Value of the cell to any string which uses our custom XML Format, just like the UltraFormattedLinkLabel control.
So you could put text and a link in the cell together by using a cell value like this:
"Trans. No: <a href = \"http://www.whatever.com\">1234567890</a>"
If you want to trap clicks on this link instead of just letting the O/S launch the URL, then you would have to use a FormattedLinkLabel control as the EditorComponent of the cell/column. In this case, you do not need to set the Style, and you can trap the LinkClicked event of the FormattedLinkLabel.
Assuming the data type of the column to be typeof(object): set the column's Style property to 'URL', then assign a value like this to the cell:
cell.Value = new Infragistics.Win.FormattedLinkLabel.ParsedFormattedTextValue( "<a href = \"http://www.whatever.com\">1234567890</a>");