asp:button in datalist doesn't fire event with VS
-
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.
-
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.
Hi there. Just to rule out a couple of things - are you coding for the
ItemCommand
event of theDataList
? then using aCommandName
andCommandArgument
on theButton
? If so, are you declaring theButton
at design time or runtime? -
Hi there. Just to rule out a couple of things - are you coding for the
ItemCommand
event of theDataList
? then using aCommandName
andCommandArgument
on theButton
? If so, are you declaring theButton
at design time or runtime?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?