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. How do I display NO text next to items in a CheckBoxList??

How do I display NO text next to items in a CheckBoxList??

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 4 Posters 2 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.
  • L Offline
    L Offline
    lnong
    wrote on last edited by
    #1

    I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???

    P M J 3 Replies Last reply
    0
    • L lnong

      I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???

      P Offline
      P Offline
      Paul Riley
      wrote on last edited by
      #2

      If nobody suggests a better way, why don't you have an extra column in your data table that is never populated and bind it to that? Or even populate that field with your custom text by hand rather than from the database? Paul We all will feed the worms and trees
      So don't be shy
      - Queens of the Stone Age, Mosquito Song

      1 Reply Last reply
      0
      • L lnong

        I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???

        M Offline
        M Offline
        Member 96
        wrote on last edited by
        #3

        I came across this when looking for something else, not sure if it will help or not but here it is anyway: Top Questions about the DataGrid Web Server Control Selecting Multiple Items Using a Check Box (Hotmail Model) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchtopquestionsaboutaspnetdatagridservercontrol.asp[^]


        I support two teams - The Canucks and whoever is playing the Leafs[

        ](http://www.canucks.com)

        1 Reply Last reply
        0
        • L lnong

          I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???

          J Offline
          J Offline
          Jim MacDonald 0
          wrote on last edited by
          #4

          You could also loop through your list after you databind and either remove the text or add your custom labels. foreach (ListItem li in checkBoxList.Items) { li.Text = String.Empty; }

          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