Create textbox like query editor in sql server
-
Hi, I am working on ASP.NET(c#)/SQL Server project. I my project i want to have the textbox to show the text like the text in "SQL Script". e.g: When we write the query in sql Server the color of reserved words (like "select", "where" etc) changes to blue, the color of commented lines changes to green and the other text remains the same. Please guide me how to do this. Sonia
-
Hi, I am working on ASP.NET(c#)/SQL Server project. I my project i want to have the textbox to show the text like the text in "SQL Script". e.g: When we write the query in sql Server the color of reserved words (like "select", "where" etc) changes to blue, the color of commented lines changes to green and the other text remains the same. Please guide me how to do this. Sonia
-
Hi, I am working on ASP.NET(c#)/SQL Server project. I my project i want to have the textbox to show the text like the text in "SQL Script". e.g: When we write the query in sql Server the color of reserved words (like "select", "where" etc) changes to blue, the color of commented lines changes to green and the other text remains the same. Please guide me how to do this. Sonia
You can not do it in TextBox, You have to use div element. On keypress event, you have to call javascript function where you need to read all string of div by splinting space and check if word are in listing then add font attribute or span attribute around word and set style. Search in google for how to write on div element. Regard Imrankhan
please don't forget to vote on the post that helped you.
-
Create a list of reserved words, and as the user types in check the word against your list and colour appropriately.
Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP
How can i use different colors in a single textbox.
-
You can not do it in TextBox, You have to use div element. On keypress event, you have to call javascript function where you need to read all string of div by splinting space and check if word are in listing then add font attribute or span attribute around word and set style. Search in google for how to write on div element. Regard Imrankhan
please don't forget to vote on the post that helped you.
I do not have too much knowledge of javascript. Please tell me the solution in c#.
-
How can i use different colors in a single textbox.
It was a trick answer. Of course you can't, you need to put it into some other sort of control, say a div, and you will have to do it in javascript unless you want to post back to the server each time. Now use you initiative and google, there are loads of examples
Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP