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 postback

user control and postback

Scheduled Pinned Locked Moved ASP.NET
databasetutorialquestionannouncement
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.
  • J Offline
    J Offline
    jetset32
    wrote on last edited by
    #1

    hi, I've got a user control which is loaded onto the webform via a dropdownlist. the user control has a button control on it which is supposed to update an sql database. but when the button is clicked the page returns to its original state, minus the usercontrol, this is because of the postback, plus the code in the button control does not seem to execute as the database is not updated. I know all the code works, only if the usercontrol is put directly on the page i.e. postback does not have any effect. anybody have any ideas on how to get around this??? Thanks JetSet

    A 1 Reply Last reply
    0
    • J jetset32

      hi, I've got a user control which is loaded onto the webform via a dropdownlist. the user control has a button control on it which is supposed to update an sql database. but when the button is clicked the page returns to its original state, minus the usercontrol, this is because of the postback, plus the code in the button control does not seem to execute as the database is not updated. I know all the code works, only if the usercontrol is put directly on the page i.e. postback does not have any effect. anybody have any ideas on how to get around this??? Thanks JetSet

      A Offline
      A Offline
      Alvaro Mendez
      wrote on last edited by
      #2

      Be sure the user control is added before the Viewstate is loaded. One easy and slick way to do this is to directly add the user control to your page (using the designer) as if you were always going to show it. Then set the Visible property to false. So when the user changes the dropdown list set Visible to true. Regards, Alvaro


      You know what they say about arguing over the Internet...

      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