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. User control and event problem!

User control and event problem!

Scheduled Pinned Locked Moved ASP.NET
helpquestion
4 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.
  • B Offline
    B Offline
    benqazou
    wrote on last edited by
    #1

    Hi, I have a user control with 2 DropDownLists. Inside the user control, I have an event : If (dropdownlist1.SelectedIndex == 0) dropdonwnlis2.SelectedIndex = 0; I fisrt included the user control into a page test.aspx. The event worked fine. (ie. When i choose the fisrt item of the first dropdownlist, the selected item of the second dropdownlist is set to the first.) But when I included it in another page, all worked fine, except that event! What would be the problem??? It just seems so strange. Thanks!!

    T 1 Reply Last reply
    0
    • B benqazou

      Hi, I have a user control with 2 DropDownLists. Inside the user control, I have an event : If (dropdownlist1.SelectedIndex == 0) dropdonwnlis2.SelectedIndex = 0; I fisrt included the user control into a page test.aspx. The event worked fine. (ie. When i choose the fisrt item of the first dropdownlist, the selected item of the second dropdownlist is set to the first.) But when I included it in another page, all worked fine, except that event! What would be the problem??? It just seems so strange. Thanks!!

      T Offline
      T Offline
      thomasa
      wrote on last edited by
      #2

      you could just be missing the runat="server" tag. Or in manny cases (a bugg by microsoft) the Visual Studio .Net removes the this.dropdownlist1.SelectedIndexChanged += new System.EventHandler(this.dropdownlist1_SelectedIndexChanged); from the private void InitializeComponent() Hope it helps Thomas

      B 1 Reply Last reply
      0
      • T thomasa

        you could just be missing the runat="server" tag. Or in manny cases (a bugg by microsoft) the Visual Studio .Net removes the this.dropdownlist1.SelectedIndexChanged += new System.EventHandler(this.dropdownlist1_SelectedIndexChanged); from the private void InitializeComponent() Hope it helps Thomas

        B Offline
        B Offline
        benqazou
        wrote on last edited by
        #3

        Thanks first, Curiously, as I said, the control is 100% functional in one page (test.aspx). I have the problem in another page (even in the latter page, the AutoPostBack works fine!) The runat=server is just there. Everything seems OK. ?! Thanks!!

        T 1 Reply Last reply
        0
        • B benqazou

          Thanks first, Curiously, as I said, the control is 100% functional in one page (test.aspx). I have the problem in another page (even in the latter page, the AutoPostBack works fine!) The runat=server is just there. Everything seems OK. ?! Thanks!!

          T Offline
          T Offline
          thomasa
          wrote on last edited by
          #4

          Yes, that seems odd. You better set a breakpoint, and stepp your way trought the proses. It could be that the value of the dropdownbox don't have been fetched.

          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