How to change properties of partial text in a textbox - asp.net

How to make a textbox that can highlight partial text and change the color of partial text by code on the server side? Say, when user types the word dog, the word is highligted in green.

A textbox <input> or <textarea> can't do this. You'd probably have to do it by using a content-editable element, and wrap the words they spelled incorrectly with spans within that element.

Related

ASP.NET drowdownlist item text preceding blank space is not rendered

I need to indent some dropdownlist item texts to right based upon a condition. For this I simply add blank space to the left of those item text, however they don't get rendered and the texts get trimmed. Here's what I've tried so far:
Left padded certain texts right in the database (the dropdown list is populated from database)
item.Text=" "+item.Text;
item.Text=" "+item.Text;
None of the above methods work. What is the proper way of doing this? I don't want to go CSS.
Here is the jsfiddle
I think this is more a HTML then ASP.NET issue. In HTML spaces are trimmed between elements. The spec determined that 'non-significant' whitespace must be removed.
You have to use to make a 'significant' whitespace which will be rendered when at the start or end of an element.

How to change the background color of a line of user input in a textarea?

I know how to change the background color of a textarea, but what about changing the background color of the text that users type into a text area?
For example, in HTML you can change the background color of a span of text using span tags, ie:
<span style="background-color: blue">Words with blue background</span>
...But what about the text that users type into a text field?
I need to do this for a form that I'm creating, so that users can clearly see spaces and returns they're entering as well as the characters they enter.
Can it be done using CSS?
No.
But there is the other way around.
Did you ever used editor in github.com? It's cool.
It uses javascript and <div> to control the style of each line of code.
And translate.google.com uses the same way.

Primefaces splitButton rendering issue when no text is on the button

My splitButton should not have any text on the button. So when I try to achieve this using by providing blank value for the value attribute, the button shrinks to a very small size. I want it to remain the size of the dropdown button which appears beside it. I don't have an actionListener, therefore I need the button to display no text.
Is there no default size set to the button when it contains no text? Or is it possible to apply a style property to it?
Put the value attribute like this:
value=" "

Change background color of select characters of an input textfield

The user enters a string into a traditional html input field (type="text"). For example, lets say the input is "2013/13/29". At validation, the RegEx determin that 13 is invalid. I want the "13"'s background-color to become red and all other character's background-color to become green. Can this be done in HTML? Perhaps the use of a span inside an input tag.
Short answer, you can't add a span inside input tag.
try using jqueryUI datetimepicker, it will save you a lot of time.
http://jqueryui.com/datepicker/

Displaying a note when focus comes over a text box

I want to display a note to the user whenever the focus comes to a particular textbox i have written the note in a div and set its visibility to false what to do next
Instead of your div, put that text into a ToolTip property on the textbox control and ASP.NET will take care of it for you.

Resources