2

I have written a piece of code in C#. That is, dynamically adding TextBoxs to edit data coming from database.
I am getting issues if the data contains URLs.
I need to show the data in textboxs as it is in database, but I am getting appended hyperlinks into the textboxs.

Example :-

Data : My URL :http://localhost/web/report.aspx?Id=5&code=66634

Text in the textbox look like below

My URL http://localhost/web/report.aspx?Id=5&code=66634

Could some one please help me why hyperlinks came in my case?

4
  • pavan, this wont happen at all unless the code linkify your data. why dont you debug? best, before that, why dont you check your data at db? Commented Oct 19, 2011 at 12:20
  • 1
    possible duplicate of Remove HyperLinks from text Commented Oct 19, 2011 at 12:21
  • 1
    @Alon_A: this is tagged asp.net and rich textbox is a winforms control. and OP has not mentioned about using any thrird party controls. very confused at OP's question. Commented Oct 19, 2011 at 12:25
  • @naveen Yeah thanks, question is not fully cleared. That's why its possible dup, though I have a feeling that's what he meant :) Commented Oct 19, 2011 at 12:27

1 Answer 1

0

If I understand your question, you are trying to prevent your [rich] textbox from automatically recognizing URLs. If that's the case, simply flip the DetectUrls bool:

myRichTextBox.DetectUrls = false;
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks James : I am using TextBox class, Do I need to set the flag similar to DetectUrls in my case?
@user1003086, Are you sure you're not using a single-line RichTextBox control? I don't think the TextBox control has the ability to detect URLs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.