Skip to content Skip to sidebar Skip to footer

How Do I Add Html Links In C# Textbox?

How can I put a link in a C# TextBox? I have tried to put HTML tags in the box but instead of showing a link it shows the entire HTML tag. Can this be done with a TextBox?

Solution 1:

Use the RichTextBox, no need to build your own, it cames with VS

Solution 2:

I would try using an editable div and making it look like a text box. This would allow you to get user input and use links.

To make this easier, try JEditable.

Solution 3:

If that is in windows forms and you really can't use the richtextbox, you can create a control with a linklabel inside of textbox.

http://www.codeproject.com/KB/miscctrl/LinkTextBox.aspx

Solution 4:

I would think about this a little bit. If you allow executable code in an editable control, the user, the user can execute ANY code. This is generally a bad idea.

The behavior of the C# control is intentional to prevent the exact behavior that you are trying to create. A little creativity (such as parsing out links from the text box and creating a list of links next or below the text box) will provide a much safer application.

Solution 5:

To my knowledge not with the standard textbox. You'd have to create your own. One option it the Telerik controls, they're a little pricey for individual development, but very robust and configurable.

Post a Comment for "How Do I Add Html Links In C# Textbox?"