Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Create textbox like query editor in sql server

Create textbox like query editor in sql server

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasetutorialasp-netsql-server
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dot Net Dev
    wrote on last edited by
    #1

    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

    A I 2 Replies Last reply
    0
    • D Dot Net Dev

      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

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • D Dot Net Dev

        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

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #3

        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.

        D 1 Reply Last reply
        0
        • A Ashfield

          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

          D Offline
          D Offline
          Dot Net Dev
          wrote on last edited by
          #4

          How can i use different colors in a single textbox.

          A 1 Reply Last reply
          0
          • I Imran Khan Pathan

            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.

            D Offline
            D Offline
            Dot Net Dev
            wrote on last edited by
            #5

            I do not have too much knowledge of javascript. Please tell me the solution in c#.

            1 Reply Last reply
            0
            • D Dot Net Dev

              How can i use different colors in a single textbox.

              A Offline
              A Offline
              Ashfield
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups