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. Dynamically created button holding relevant data

Dynamically created button holding relevant data

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestionasp-netdatabase
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
    joon vh
    wrote on last edited by
    #1

    Little problem involving ASP.NET, C#, ImageButtons and events I have a list of many items. These are displayed as imagebuttons, and their NavigateUrl property is set to 'page.aspx?productID=' + item.productID. This works just fine, but the problem is that this actually results in a redirect, when a simple postback is enough. The list of items is still displayed, and when redirect happens, it has to be retrieved again from the DB, whereas with postback it can just stay the same, and the new information is added to it. How can I fix this? Is there a way to add some data (like productID) to a button, give all the dynamic buttons the same event, so that when it is pressed, you can get the information from the object sender parameter in the event? Thank you


    Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

    V 1 Reply Last reply
    0
    • J joon vh

      Little problem involving ASP.NET, C#, ImageButtons and events I have a list of many items. These are displayed as imagebuttons, and their NavigateUrl property is set to 'page.aspx?productID=' + item.productID. This works just fine, but the problem is that this actually results in a redirect, when a simple postback is enough. The list of items is still displayed, and when redirect happens, it has to be retrieved again from the DB, whereas with postback it can just stay the same, and the new information is added to it. How can I fix this? Is there a way to add some data (like productID) to a button, give all the dynamic buttons the same event, so that when it is pressed, you can get the information from the object sender parameter in the event? Thank you


      Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

      V Offline
      V Offline
      Venkatesh Mookkan
      wrote on last edited by
      #2

      If you are using ImageButton, you can use PostbackUrl Property of the ImageButton. It does same as the NavigateUrl, but with a IsPostback = True. Check it out... I have used it long time before.

      Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group

      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