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. Setting values to a UserControl

Setting values to a UserControl

Scheduled Pinned Locked Moved ASP.NET
databasequestion
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
    Ria77
    wrote on last edited by
    #1

    I have created a usercontrol having a dropdownlist together with other functionality. I need to set the selectedindex of the dropdown from the values saved in the database. Although the value is passing successfully to the set value, however am not seeing the values shown in the dropdownlist. Any ideas? Following is a snippet of my code; Private _selRequest As Integer Public Property RequestValue() As Integer Get Return _selRequest End Get Set(ByVal Value As Integer) _selRequest = Value Me.drpPersons.SelectedIndex = _selRequest End Set End Property

    A 1 Reply Last reply
    0
    • R Ria77

      I have created a usercontrol having a dropdownlist together with other functionality. I need to set the selectedindex of the dropdown from the values saved in the database. Although the value is passing successfully to the set value, however am not seeing the values shown in the dropdownlist. Any ideas? Following is a snippet of my code; Private _selRequest As Integer Public Property RequestValue() As Integer Get Return _selRequest End Get Set(ByVal Value As Integer) _selRequest = Value Me.drpPersons.SelectedIndex = _selRequest End Set End Property

      A Offline
      A Offline
      Anil Ch
      wrote on last edited by
      #2

      Hi, try checking the page load event of your page that is using this control. see if u have if(!IspostBack) in your page load. or try to add a public function to set the dropdown in the control.(set property should would be same but still u can give a try) Regards, Anil :)

      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