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. asp:button in datalist doesn't fire event with VS

asp:button in datalist doesn't fire event with VS

Scheduled Pinned Locked Moved ASP.NET
visual-studiohelpcsharpquestion
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.
  • L Offline
    L Offline
    larbo204
    wrote on last edited by
    #1

    If I have an asp:Button in an asp:datalist it won't fire an event. But if I use asp:LinkButton it works fine. If I use an asp:Button outside the datalist then it fires. This is if I use Visual Studio. If I write the code in a text editor, both kind of buttons fire events. So I guess it's a bug in VS. But how do I fix it. I can't manuallay add an event handler to the button cause it's in the datalist.

    M 1 Reply Last reply
    0
    • L larbo204

      If I have an asp:Button in an asp:datalist it won't fire an event. But if I use asp:LinkButton it works fine. If I use an asp:Button outside the datalist then it fires. This is if I use Visual Studio. If I write the code in a text editor, both kind of buttons fire events. So I guess it's a bug in VS. But how do I fix it. I can't manuallay add an event handler to the button cause it's in the datalist.

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi there. Just to rule out a couple of things - are you coding for the ItemCommand event of the DataList? then using a CommandName and CommandArgument on the Button? If so, are you declaring the Button at design time or runtime?

      L 1 Reply Last reply
      0
      • M Mike Ellison

        Hi there. Just to rule out a couple of things - are you coding for the ItemCommand event of the DataList? then using a CommandName and CommandArgument on the Button? If so, are you declaring the Button at design time or runtime?

        L Offline
        L Offline
        larbo204
        wrote on last edited by
        #3

        I tried all different command names. I'm not declaring any button using "new" so I guess it's all in runtime.I tried to add the button in the design mode in VS and manually in the html code. No matter how I do it's just linkbutton that works. When I do it in design mode I tried the edittemplate tool and assigning commandname and onitemcommand etc via property window. When I use a linkbutton and place the cursor over the linkbutton I can read "javascript:_doPostBack......." in the IE status bar but not with a button. If I place a button outside the datalist the it works fine. Remember, none of these problems occur if I code in a texteditor instead of VS. Another bugg is that if I compile the project and I'm not in the desing window at that time then I can't open the property window without restarting VS. Can anyone help me?

        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