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. Format the string inside a ListItem

Format the string inside a ListItem

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
2 Posts 2 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.
  • R Offline
    R Offline
    RickardB
    wrote on last edited by
    #1

    Hi, I would need to arrange the text property of a ListItem into columns, i.e. I need to pad the substring. Example: string 1 string 2 should become: "string 1 " "string 2 " Then I need to add them together, the result should be "string 1 string 2 " I know how to pad a string using the PadLeft command but when I try to assign the Text property of a ListItem the space between the substrings (string 1 and string 2) in this case is schrinked to a single space. The reason I want to do this is that I want to add this ListItems to a DropDownListBox and the text inside it needs to formatted into columns. Anyone who can give me any advice? R Rickard

    B 1 Reply Last reply
    0
    • R RickardB

      Hi, I would need to arrange the text property of a ListItem into columns, i.e. I need to pad the substring. Example: string 1 string 2 should become: "string 1 " "string 2 " Then I need to add them together, the result should be "string 1 string 2 " I know how to pad a string using the PadLeft command but when I try to assign the Text property of a ListItem the space between the substrings (string 1 and string 2) in this case is schrinked to a single space. The reason I want to do this is that I want to add this ListItems to a DropDownListBox and the text inside it needs to formatted into columns. Anyone who can give me any advice? R Rickard

      B Offline
      B Offline
      Brian M C
      wrote on last edited by
      #2

      Rickard, When you apply the PadLeft command to the string are you reassigning the newly created string to the old. For example: String string1 = "Some Text"; string1 = string1.PadLeft( 5, " " ); HTH, -Brian C.

      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