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. Multiline in a Label?

Multiline in a Label?

Scheduled Pinned Locked Moved ASP.NET
questiontutorial
19 Posts 6 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.
  • C Offline
    C Offline
    chand10
    wrote on last edited by
    #1

    Hi I struck with an application in that I have a Label which is used to filled with a column of the Table, the column contains huge text. The Label is displaying the whole text in a single line, making the page to strech along the text I want to cut down the Text into multiple lines and display it in the Label. How can I implement this. I am using DataRow to fill the Label. Suggest me an example.

    I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

    I B N C 5 Replies Last reply
    0
    • C chand10

      Hi I struck with an application in that I have a Label which is used to filled with a column of the Table, the column contains huge text. The Label is displaying the whole text in a single line, making the page to strech along the text I want to cut down the Text into multiple lines and display it in the Label. How can I implement this. I am using DataRow to fill the Label. Suggest me an example.

      I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

      GIve fixed width in pixel to Label Best Regard Pathan

      GOD HELP THOSE WHO HELP THEMSELVES

      N C 2 Replies Last reply
      0
      • I Imran Khan Pathan

        GIve fixed width in pixel to Label Best Regard Pathan

        GOD HELP THOSE WHO HELP THEMSELVES

        N Offline
        N Offline
        Neema Vikas
        wrote on last edited by
        #3

        Use \n in string

        I 1 Reply Last reply
        0
        • N Neema Vikas

          Use \n in string

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

          Neema Why did u reply to me? Reply to Chand10

          ---------------------------------------------------

          1 Reply Last reply
          0
          • C chand10

            Hi I struck with an application in that I have a Label which is used to filled with a column of the Table, the column contains huge text. The Label is displaying the whole text in a single line, making the page to strech along the text I want to cut down the Text into multiple lines and display it in the Label. How can I implement this. I am using DataRow to fill the Label. Suggest me an example.

            I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

            B Offline
            B Offline
            Blue_Boy
            wrote on last edited by
            #5

            use System.Environment.NewLine


            I Love SQL

            C 1 Reply Last reply
            0
            • C chand10

              Hi I struck with an application in that I have a Label which is used to filled with a column of the Table, the column contains huge text. The Label is displaying the whole text in a single line, making the page to strech along the text I want to cut down the Text into multiple lines and display it in the Label. How can I implement this. I am using DataRow to fill the Label. Suggest me an example.

              I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              ASP.NET will render Label control to normal HTML span. So you can give a HTML Line break ( <br /> ) to break the line.


              My Website | Ask smart questions

              C 1 Reply Last reply
              0
              • C chand10

                Hi I struck with an application in that I have a Label which is used to filled with a column of the Table, the column contains huge text. The Label is displaying the whole text in a single line, making the page to strech along the text I want to cut down the Text into multiple lines and display it in the Label. How can I implement this. I am using DataRow to fill the Label. Suggest me an example.

                I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

                Use Environment.NewLine to introduce a line break.

                Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                C N 2 Replies Last reply
                0
                • I Imran Khan Pathan

                  GIve fixed width in pixel to Label Best Regard Pathan

                  GOD HELP THOSE WHO HELP THEMSELVES

                  C Offline
                  C Offline
                  chand10
                  wrote on last edited by
                  #8

                  Thanks for u r reply. I already given width to the Label but still it is not working.

                  I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                  1 Reply Last reply
                  0
                  • C Christian Graus

                    Use Environment.NewLine to introduce a line break.

                    Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                    C Offline
                    C Offline
                    chand10
                    wrote on last edited by
                    #9

                    Thank for replying. How to to use Environment.NewLine with a Label.

                    I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                    C 1 Reply Last reply
                    0
                    • B Blue_Boy

                      use System.Environment.NewLine


                      I Love SQL

                      C Offline
                      C Offline
                      chand10
                      wrote on last edited by
                      #10

                      Thank for replying. How to to use Environment.NewLine with a Label.

                      I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                      B 1 Reply Last reply
                      0
                      • C chand10

                        Thank for replying. How to to use Environment.NewLine with a Label.

                        I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

                        The string that is to be displayed, should include Enviroment.NewLine whenever you want a line break in the text.

                        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                        C 1 Reply Last reply
                        0
                        • N N a v a n e e t h

                          ASP.NET will render Label control to normal HTML span. So you can give a HTML Line break ( <br /> ) to break the line.


                          My Website | Ask smart questions

                          C Offline
                          C Offline
                          chand10
                          wrote on last edited by
                          #12

                          Thank for replying. How can we insert a
                          in between a text which is coming directly from Database. I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                          1 Reply Last reply
                          0
                          • C Christian Graus

                            Use Environment.NewLine to introduce a line break.

                            Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                            N Offline
                            N Offline
                            N a v a n e e t h
                            wrote on last edited by
                            #13

                            Christian Graus wrote:

                            Use Environment.NewLine to introduce a line break.

                            I doubt, will it work on ASP Label ?


                            My Website | Ask smart questions

                            1 Reply Last reply
                            0
                            • C Christian Graus

                              The string that is to be displayed, should include Enviroment.NewLine whenever you want a line break in the text.

                              Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                              C Offline
                              C Offline
                              chand10
                              wrote on last edited by
                              #14

                              Plz suggest me an example.

                              I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                              C 1 Reply Last reply
                              0
                              • C chand10

                                Thank for replying. How to to use Environment.NewLine with a Label.

                                I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                                B Offline
                                B Offline
                                Blue_Boy
                                wrote on last edited by
                                #15

                                using System.Environment.NewLine in ASP.NET 2.0[^]


                                I Love SQL

                                1 Reply Last reply
                                0
                                • C chand10

                                  Plz suggest me an example.

                                  I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

                                  If you're using ASP.NET, then you need to insert a
                                  tag instead. I can't percieve of how you'd need an example. A label is just a div with text in it, and in HTML, the text just flows until you have a break tag. If you don't know that, you need to buy a book and read it. string s = "This is the first line
                                  this is the second line"; Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                                  C 1 Reply Last reply
                                  0
                                  • C Christian Graus

                                    If you're using ASP.NET, then you need to insert a
                                    tag instead. I can't percieve of how you'd need an example. A label is just a div with text in it, and in HTML, the text just flows until you have a break tag. If you don't know that, you need to buy a book and read it. string s = "This is the first line
                                    this is the second line"; Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                                    C Offline
                                    C Offline
                                    chand10
                                    wrote on last edited by
                                    #17

                                    Ohhh!I think u did not get my Question. I am not asking, How to insert a BreakLine Tag. I am asking, How to SPLIT a Large sentance(a single record from the table) to some lines coming from DataBase before giving it to the Label, so that the record is displayed as a paragraph in the lable not as a sentence. Anyway thank u for u r reply

                                    I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                                    N 1 Reply Last reply
                                    0
                                    • C chand10

                                      Ohhh!I think u did not get my Question. I am not asking, How to insert a BreakLine Tag. I am asking, How to SPLIT a Large sentance(a single record from the table) to some lines coming from DataBase before giving it to the Label, so that the record is displayed as a paragraph in the lable not as a sentence. Anyway thank u for u r reply

                                      I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

                                      N Offline
                                      N Offline
                                      N a v a n e e t h
                                      wrote on last edited by
                                      #18

                                      chand10 wrote:

                                      Ohhh!I think u did not get my Question. I am not asking, How to insert a BreakLine Tag.

                                      Why don't you tell this in the beginning ?

                                      chand10 wrote:

                                      I am asking, How to SPLIT a Large sentance(a single record from the table) to some lines coming from DataBase before giving it to the Label, so that the record is displayed as a paragraph in the lable not as a sentence.

                                      CSS having a property called wraptext. Try using that. But it is IE specific. Alternatively you can use substring to cut your big sentence and insert line break. This will display like a paragraph.


                                      My Website | Ask smart questions

                                      1 Reply Last reply
                                      0
                                      • C chand10

                                        Hi I struck with an application in that I have a Label which is used to filled with a column of the Table, the column contains huge text. The Label is displaying the whole text in a single line, making the page to strech along the text I want to cut down the Text into multiple lines and display it in the Label. How can I implement this. I am using DataRow to fill the Label. Suggest me an example.

                                        I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

                                        If ur text contains whitespace char then no need to do anything.It will be automatically taken in new Line. I thing ur text doesn't contains any whitespace char and thats why this problem arises Best Regard Pathan

                                        ---------------------------------------------------

                                        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