By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

Dead Buttons

P: n/a
I have 2 datalist each has 3 buttons in the datalist.

One Datalist, only 2 of the three buttons work in the other one is dead
(no postback, not nothing).

I have another Datalist and on this one, all three buttons are dead (not
postback, not nothing).

To get a button to work on the are the rules that I know

1. Specify the appropriate "On..." Event attribute when defining the
DataList object. So if you intend to use the "Delete" Command Button,
you must have specified the "OnDeleteCommand" with some method which is
set up to handle the event... "OnDeleteCommand=DoItemDelete".
2. When creating the button in the "EditItemTemplate", you must specify
provide the "CommandName" attribute of the button, and this name must be
"Update" or "Cancel" or "Delete". The command must have the
"Runat='Server' specified as well

SO what am I missing to get these buttons to work?

Here is some code....

<asp:datalist id="dlPPIP" runat="server"
OnUpdateCommand="PPIP_Process_Update" DataKeyField="PPIP_ID"
EditItemStyle-BackColor="Yellow" EditItemStyle-ForeColor="black"
OnEditCommand="PPIP_Process_Edit" GridLines="Both">
<asp:Button ID="cmdPPIPEditUpdate" CommandName="Update" Text="Update"
Runat="server" CausesValidation="True"></asp:Button>

<asp:Button ID="cmdPPIPEditCancel" CommandName="Cancel" Text="Cancel"
Runat="server" CausesValidation="True"></asp:Button>

<asp:Button ID="cmdPPIPEditDelete" CommandName="Delete" Text="Delete"
Runat="server" BackColor="red" ForeColor="white" Font-Bold="True"
If you remove the method for "Update", the error is caught when the form
is attempting to display, so the system is definitely looking for the
form, but it is not wiring the button to the event...what can I
check/change to get this to work?
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a

Usually this behaviour is due to rebinding the data list on postback.
ensure that you use if(!IsPostBack) to fill datalist just on first call
to page.


Natty Gur[MVP]

blog :
Mobile: +972-(0)58-888377
*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

P: n/a
The problem turn out to be the Validation controls. I did not place an
error message on the controls, and so they were detecting errors at the
client and never doing a post back because the page did not pass local
validation. It really looks like you button is dead when you forget to
provide an error message on validation controls.
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.