在asp.net的文本框中突出显示某些文本

时间:2014-01-22 09:29:03

标签: c# asp.net textbox freetextbox

asp.net 中我需要TextBox来突出显示某些事件时输入文本时的某些文字(如 Microsoft Word 拼写检查功能) 。

我一直在使用freetextbox,它会在按钮点击时突出显示文本但不会自动显示。

怎么做?
我应该使用另一个控件吗?

2 个答案:

答案 0 :(得分:0)

您可以使用RichTextBox来执行此操作。 使用RichTextBox,您可以着色或突出显示单行或单词。

    // select characters from index 0 to 9
     richTextBox1.Select(0, 10);

   //will color the selected text.
   richTextBox1.SelectionColor = Color.Green;    

查看此link以获取教程。

答案 1 :(得分:-1)

您可以使用jquery并检查每个按键,当您的单词组合满足时,您可以使用css突出显示文本。

函数是.keypress() - more on keypress

相关问题