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. Add ListItem to Custom DropDownList

Add ListItem to Custom DropDownList

Scheduled Pinned Locked Moved ASP.NET
3 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.
  • M Offline
    M Offline
    mehran asg
    wrote on last edited by
    #1

    I created a custom dropdownlist. (inherit from standard dropdownlist control) I want to add ListItem inside this control. but I don't know where I must add ListItem. I add it in RenderContent method but I received NullRefrenceException .

    B 1 Reply Last reply
    0
    • M mehran asg

      I created a custom dropdownlist. (inherit from standard dropdownlist control) I want to add ListItem inside this control. but I don't know where I must add ListItem. I add it in RenderContent method but I received NullRefrenceException .

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

      DropDownList1.Items.Add(new ListItem("ItemString", "ItemValue"));


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

      M 1 Reply Last reply
      0
      • B Blue_Boy

        DropDownList1.Items.Add(new ListItem("ItemString", "ItemValue"));


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

        M Offline
        M Offline
        mehran asg
        wrote on last edited by
        #3

        I konw that! but I want create custom dropdownlist with 3 default items

        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