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)
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>");
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.
Sorry about that, I was referring to the directions in the earlier mentioned issue. I'll explain step-by-step what I'm doing, so I don't miss anything.
So, I added the ultraformattedlinklabel onto the ultragrid, then enter the ultrawingrid designer of the application. I open up the column, and select columns, then I select the specific column I would like to have a link (later I'd like to have it call a separate method, using the link clicked method). Then I add the ultraFormattedLinkLabel onto this specific column's EditorComponent.
This part alone is where I've traced the error of data not showing up. The ultra grid loads the headers, but it has none of the data that goes into the columns. So, when I run the program, the only thing that shows up is the header for the data, and the ultraFormattedLinkLabel; if I haven't set it's visibility to false. Either way, it doesn't show the data. Another thing about the column, it is bound to a dataset, which may or may not be causing this issue. I'm not familiar enough to say, definitively. Hope this helps explain it a little better.
So which columns aren't showing any data? All of them? Or just the column with the UltraFormattedLinkLabel attached. I'm confused because you say you are attaching the UltraFormattedLinkLabel to a single column, but then you say that "columns" (plural) are not showing any data.
What's the data type of the column that you are attaching the UltraFormattedLinkLabel to?
Does the column contain strings that are hyperlinks?
Can you post a small sample project demonstrating the issue? That would probably save a lot of time.
Greetings Mike,
The column is of type System.Decimal and in this case all of the columns do not show when I set the EditorComponent to UltraFormattedLinkLabel, or if I change the style of the column to URL. As mentioned before, it is bound to a dataset, which is an enumeration. The enumeration has a string of the word that I would like to convert to an URL. And, I see how that could be a problem, I'm just not sure of how. We've tried converting the text component to a URL, with the InitializeRow method, but it had no effect. None of the text changes, and hence we cannot envoke an onLinkClicked style method.
Hope this helps and thanks,
Dan
Hi Dan,
I seem to be getting more and more confused. If the column is of type Decimal that might cause a problem. The FormattedLinkLabel expects a string. I would think it would work, because a decimal (or pretty much anything) can be converted to a string. But you'd never be able to show a link using decimal data, since it cannot possibly contain the XML necessary to define a hyperlink.
I'm also baffled by what you mean when you say the "dataset is an enumeration." Unless you are using the word enumeration is some way I don't understand, this doesn't make sense to me. An enumeration is a data type, a data set can't be one.
At this point, I'm not even clear on exactly what you are trying to achieve. Maybe you could post a small sample project here or some screen shots of what you want to achieve?
Sorry, I wasn't clear enough. The code is a bit confusing for me to understand as well. I'll describe the column first,
Style: DropDownListValueList: Status // The status is a string descriptor, based on the enumerated decimal value
// So, this is where the value list used in the grid is populated. ValueList list = dgStat.DisplayLayout.ValueLists["NStatus"]; foreach ( NStatus status in System.Enum.GetValues(typeof( NStatus))) list.ValueListItems.Add((decimal)(int)status, status.ToString("F"));
// And the enumeration looks something like this:public enum NStatus{ [Description("Open")] Open = 0, [Description("Closed")] Closed = 1, [Description("Canceled")] Canceled = 2,}
The descriptions are the strings that display on the ultraGrid, and also the lines that I would like to hyperlink when canceled is the option. But, when I try to get it to link, with the above mentioned solution, all of the information on the grid, save the headers, disappear.Normal:A B C D1 2 3 42 3 4 55 6 3 7Then loses all data when the EditorComponent is set to the UltraFormattedLinkLabel the only thing that shows is:A B C DMy phrasing might be a bit off, but is this making more sense?
So let me see if I understand this...
You have a column in the grid with a ValueList with three options. And when the user selects one of those options (Cancelled), you want to cell to display as a link. Is that right?
If so, then there's no simply way to do this. If the cell has a dropdown list in it, then it has to use an editor that supports dropdown lists (typically EditorWithCombo). If you replace the cell's editor with a FormattedLinkLabel or FormattedTextEditor, then you will gain the ability to show hyperlinks, but you will lose the ability to show the dropdown list.
The only way to achieve this would be to create a FormattedTextEditor control and use an EditorButton in the ButtonsRight collection with a dropdown control on it that provides the list. But then you would have to re-implement all of the normal dropdown list functionality like choosing an item from the list updating the control and also finding the selected item on the list when it drops down.