Text as hyperlink in Text box
-
hello, i'm trying to figure out a way to get my url's to show up as url hyperlinks when i put them in a text box. something like a word doc when you put in a url it becomes a hyperlink. or such as in hotmail when you switch to rtf mode. i can do it with a label control by setting some tags on either side of say a variable and then set the text as some value. this.label1.Text += "mylink"; this works as far is that it will display the word 'mylink' and when you click, it will take you to what ever url is sitting in the variable after the href. Problem. i can't do multi lines in label controls. however, when setting the above code into a textbox it shows the code as a string as opposed to a hyperlink. so is there a way to get a text box to display these links as hyperlinks ?? am i missing something? thanks, Orion Orion orion.buttigieg@Teamplate.com www.Teamplate.com
-
hello, i'm trying to figure out a way to get my url's to show up as url hyperlinks when i put them in a text box. something like a word doc when you put in a url it becomes a hyperlink. or such as in hotmail when you switch to rtf mode. i can do it with a label control by setting some tags on either side of say a variable and then set the text as some value. this.label1.Text += "mylink"; this works as far is that it will display the word 'mylink' and when you click, it will take you to what ever url is sitting in the variable after the href. Problem. i can't do multi lines in label controls. however, when setting the above code into a textbox it shows the code as a string as opposed to a hyperlink. so is there a way to get a text box to display these links as hyperlinks ?? am i missing something? thanks, Orion Orion orion.buttigieg@Teamplate.com www.Teamplate.com
HTML textboxes don't support hyperlinks or any other formatting inside a text.
-
HTML textboxes don't support hyperlinks or any other formatting inside a text.
ok fair enough. so in light of what i'm trying to do is there a suggestion from anyone out there on how i'd go about doing this..?? Orion orion.buttigieg@Teamplate.com www.Teamplate.com
-
ok fair enough. so in light of what i'm trying to do is there a suggestion from anyone out there on how i'd go about doing this..?? Orion orion.buttigieg@Teamplate.com www.Teamplate.com
-
Use a RichTextBox?
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhidont use a text box. The only way to do this is to use a DIV tag instead and set the CONTENTEDITABLE attribute of the DIV tag as such:
<DIV id=myRichText CONTENTEDITABLE></DIV>
This will not only allow you to have links but full HTML editing capabilities. The only problem is that if you want this to be submited to a web form you will need to have a hidden input control and on submit set the value of the hidden control to the innerHTML of the DIV tag. Oh, and this works in IE only not Netscape or Opera:( hope this helps theJazzyBrain Wise is he who asks good questions, not he who gives good answers -
dont use a text box. The only way to do this is to use a DIV tag instead and set the CONTENTEDITABLE attribute of the DIV tag as such:
<DIV id=myRichText CONTENTEDITABLE></DIV>
This will not only allow you to have links but full HTML editing capabilities. The only problem is that if you want this to be submited to a web form you will need to have a hidden input control and on submit set the value of the hidden control to the innerHTML of the DIV tag. Oh, and this works in IE only not Netscape or Opera:( hope this helps theJazzyBrain Wise is he who asks good questions, not he who gives good answersthanks for that suggestion. i didn't know i could do that. but these are web forms i'm dealing with, and for reasons i won't get into i'm limited to the type of web controls i can use. a rich text box isn't one of them unfortunately. can i do it in a listcontrol?? thanks, Orion Orion orion.buttigieg@Teamplate.com www.Teamplate.com
-
thanks for that suggestion. i didn't know i could do that. but these are web forms i'm dealing with, and for reasons i won't get into i'm limited to the type of web controls i can use. a rich text box isn't one of them unfortunately. can i do it in a listcontrol?? thanks, Orion Orion orion.buttigieg@Teamplate.com www.Teamplate.com
i must always remind myself to keep things simple. on web forms you can use a listbox. a list box has both a text property and value. i set the url into the value property and set the text to whatever i want. the scroll bar is there. on the selected event i just have to grab the value from the selected item and throw that into a java script line to open that url in a new page. works like a charm and not much extra code. it doesn't show up as a hyper link but that's ok. i can always put a tool tip that tells them to click on an item. thanks for everyone's help and suggestions. :) Orion Orion orion.buttigieg@Teamplate.com www.Teamplate.com