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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. creating html control trough sql query

creating html control trough sql query

Scheduled Pinned Locked Moved ASP.NET
databasehtmlcssannouncementcareer
11 Posts 4 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.
  • M MaruBindiya

    i want to creat html textbox control using sql query. u might get surprised n think it is not possible, but i have already used it in my last job but rite now i forgot the sql syntax, it is possible. requirement was as follow there was one grid in that one column containing textbox so that one can enter multiple values at a time an update it. and this was done using sql query means i had written a sql query which was generate one colnm with textbox. mind it there wasn't any templated field. i know it can be done through templatd control but i want that sql syntax. roughly i can give idea og sql syntax. "select ''"

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #2

    You can inject any text you like into your page, and it will render as HTML. If you want to store HTML in your database, you can. I can't imagine what purpose it serves, but it's not surprising that it works. HTML is text. Your DB stores text.

    Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

    M 1 Reply Last reply
    0
    • C Christian Graus

      You can inject any text you like into your page, and it will render as HTML. If you want to store HTML in your database, you can. I can't imagine what purpose it serves, but it's not surprising that it works. HTML is text. Your DB stores text.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      M Offline
      M Offline
      MaruBindiya
      wrote on last edited by
      #3

      i want somthing like shown below Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Dim con As New SqlConnection("MyConnectionString") Dim cmd As New SqlCommand("select '', * from Table1 ", con) con.Open() GridView1.DataSource = cmd.ExecuteReader GridView1.DataBind() con.Close() End If End Sub this code giving error msg "Incorrect syntax near ' />'." so result should display grid containing one colmn with textbox.

      C P 2 Replies Last reply
      0
      • M MaruBindiya

        i want somthing like shown below Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Dim con As New SqlConnection("MyConnectionString") Dim cmd As New SqlCommand("select '', * from Table1 ", con) con.Open() GridView1.DataSource = cmd.ExecuteReader GridView1.DataBind() con.Close() End If End Sub this code giving error msg "Incorrect syntax near ' />'." so result should display grid containing one colmn with textbox.

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #4

        This is a pretty retarded way of trying to inject HTML into your grid. You can't actually hope to interact with it in any way, so what's the point ? The problem is that you have your quotes messed up. I think '' does a quote in an SQL string. As it stands, it can't work out what quotes denote the edges of the constant string, and which are part of it

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        1 Reply Last reply
        0
        • M MaruBindiya

          i want somthing like shown below Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Dim con As New SqlConnection("MyConnectionString") Dim cmd As New SqlCommand("select '', * from Table1 ", con) con.Open() GridView1.DataSource = cmd.ExecuteReader GridView1.DataBind() con.Close() End If End Sub this code giving error msg "Incorrect syntax near ' />'." so result should display grid containing one colmn with textbox.

          P Offline
          P Offline
          Paddy Boyd
          wrote on last edited by
          #5

          Really, why not just use the built in item template to get proper runtime use out of your textboxes? all you're doing here is making this harder for other people to maintain by trying to be 'clever'.

          M 1 Reply Last reply
          0
          • P Paddy Boyd

            Really, why not just use the built in item template to get proper runtime use out of your textboxes? all you're doing here is making this harder for other people to maintain by trying to be 'clever'.

            M Offline
            M Offline
            MaruBindiya
            wrote on last edited by
            #6

            mind it i m not tring to be 'clever'. i just wanna know if there is another way of doing the same thing, if u dnt know then no need of any comments...

            P 1 Reply Last reply
            0
            • M MaruBindiya

              mind it i m not tring to be 'clever'. i just wanna know if there is another way of doing the same thing, if u dnt know then no need of any comments...

              P Offline
              P Offline
              Paddy Boyd
              wrote on last edited by
              #7

              You said in your post that you were aware that it could be done through a templated column. This would be the other way of doing it...

              M 1 Reply Last reply
              0
              • P Paddy Boyd

                You said in your post that you were aware that it could be done through a templated column. This would be the other way of doing it...

                M Offline
                M Offline
                MaruBindiya
                wrote on last edited by
                #8

                this is the 1st way i have for askd 2nd way of doing it

                P 1 Reply Last reply
                0
                • M MaruBindiya

                  this is the 1st way i have for askd 2nd way of doing it

                  P Offline
                  P Offline
                  Paddy Boyd
                  wrote on last edited by
                  #9

                  Mmm. But there's nothing wrong with the first (recommended) way of doing it?

                  M 1 Reply Last reply
                  0
                  • P Paddy Boyd

                    Mmm. But there's nothing wrong with the first (recommended) way of doing it?

                    M Offline
                    M Offline
                    MaruBindiya
                    wrote on last edited by
                    #10

                    my dear frnd m not intersted to knw what u recommend......

                    J 1 Reply Last reply
                    0
                    • M MaruBindiya

                      my dear frnd m not intersted to knw what u recommend......

                      J Offline
                      J Offline
                      J4amieC
                      wrote on last edited by
                      #11

                      MaruBindiya wrote:

                      not intersted to knw what u recommend

                      Then why ask a bloody question if you're not interested in the reply. Some people!

                      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