Hi
I've been struggling with using an UltraFormattedTextEditor as a standalone control (i.e. not in a grid) on a form in a C# WinForms app to display a web hyperlink. 'TreatValueAs' is set to URL.
I want the user to be able to change the link and decided that the best approach was to make use of the EditInfo.ShowLinkDialog method to display a pop-up where they can enter a URL, Display Text and Tooltip text. This works really well. When the dialog is closed the FormattedTextEditor fully reflects what was entered in the dialog (text, URL and tooltip).
My problem is I can't figure what I need to save, say to a database, so that the FormattedTextEditor can be populated when the form is next displayed.
As an example, in the EditInfo dialog I enter: URL = 'www.google.com', Display Text = 'Google' and Tooltip Text = 'Click for Google' .
When the dialog has closed the ForrmattedTextEditor.Value property = '<a title="Click for Google" href="www.google.com">Google</a>' and I save this to a database.
When the form is next displayed I set the ForrmattedTextEditor.Value property to what was saved but then I just see the full xml string with tags exactly as it was saved. So my question is what do I need to do to achieve the same as what the EditInfo.ShowDialog is doing by setting the Display Text, URL and Tooltip text?
Hope what I have asked makes sense.
Regards
Adrian
Hello,
I tried this and it always works fine for me so I attached my sample to this post for you. Please review it and feel free to let me know if I misunderstood you or if you have any other questions.
Hi all
help me
<a href="www.google.com">Google</a>. it worked
but <a href="http://www.ebay.com/itm/ws/eBayISAPI.dll?ViewItem&item=280966487049"> ebay </a>. don't work
Hi,
Let me know if you need any help.
Regards,
Stefaniya
Hi Adrian.
ADITServices said:Do you think there could be a problem with the explicit 'URL' setting?
No, this is not a bug. If you tell the control to treat the value as a URL, then whatever text you assign as the value will be considered the entire URL. That's what the property does.
ADITServices said:1) When selecting text in the FormattedTextEditor which is formatted as a hyperlink I'm never able to select the last character. With the example above the text is Google and it's underlined and formatted as a link but if I try to double-click it to select all or try to drag select everything I never pick up the last character (the last 'e').
This sounds like a known bug that was fixed a while ago. Do you have the latest service release?
How to get the latest service release - Infragistics Community
ADITServices said:2) I was hoping that with a FormattedTextEditor in readonly mode I'd see a hand cursor when hovering over the link and would simply be able to click to open the link. But I still have to press CTRL and click to open. I can understand the need for CTRL and click in update mode but not really when it's readonly. Do you know of any workarounds for this?
The reason CTRL is required is to distinguish between the user selecting text and the user clicking on the link. Even in ReadOnly mode, the user can still select and copy from the control.
If you want a readonly link that the user cannot select text in, you should use UltraFormattedLinkLabel instead of UltraFormattedTextEditor. With the label, the hand cursor will display and the user doesn't have to hold CTRL.
Thanks Brian.
I hadn't thought of leaving TreatValueAs at the default but that works for me too. Do you think there could be a problem with the explicit 'URL' setting?
A couple of other questions for you:
1) When selecting text in the FormattedTextEditor which is formatted as a hyperlink I'm never able to select the last character. With the example above the text is Google and it's underlined and formatted as a link but if I try to double-click it to select all or try to drag select everything I never pick up the last character (the last 'e').
2) I was hoping that with a FormattedTextEditor in readonly mode I'd see a hand cursor when hovering over the link and would simply be able to click to open the link. But I still have to press CTRL and click to open. I can understand the need for CTRL and click in update mode but not really when it's readonly. Do you know of any workarounds for this?
Many thanks